Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752894AbdLDTS2 (ORCPT ); Mon, 4 Dec 2017 14:18:28 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:40089 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbdLDTRo (ORCPT ); Mon, 4 Dec 2017 14:17:44 -0500 X-Google-Smtp-Source: AGs4zMbE91HHQhs4L8ulHLy7My1Uc+nv/1HKDY82WMdR9L6Df9c8kHV1982xzoRJEoAnhSlf5AYt2g== From: Paul Lawrence To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Masahiro Yamada Cc: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kbuild@vger.kernel.org, Matthias Kaehlcke , Michael Davidson , Greg Hackmann , Paul Lawrence Subject: [PATCH v4 1/5] kasan: add compiler support for clang Date: Mon, 4 Dec 2017 11:17:31 -0800 Message-Id: <20171204191735.132544-2-paullawrence@google.com> X-Mailer: git-send-email 2.15.0.531.g2ccb3012c9-goog In-Reply-To: <20171204191735.132544-1-paullawrence@google.com> References: <20171204191735.132544-1-paullawrence@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 961 Lines: 28 For now we can hard-code ASAN ABI level 5, since historical clang builds can't build the kernel anyway. We also need to emulate gcc's __SANITIZE_ADDRESS__ flag, or memset() calls won't be instrumented. Signed-off-by: Greg Hackmann Signed-off-by: Paul Lawrence --- include/linux/compiler-clang.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index 3b609edffa8f..d02a4df3f473 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -19,3 +19,11 @@ #define randomized_struct_fields_start struct { #define randomized_struct_fields_end }; + +/* all clang versions usable with the kernel support KASAN ABI version 5 */ +#define KASAN_ABI_VERSION 5 + +/* emulate gcc's __SANITIZE_ADDRESS__ flag */ +#if __has_feature(address_sanitizer) +#define __SANITIZE_ADDRESS__ +#endif -- 2.15.0.531.g2ccb3012c9-goog