From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 1CC516B0006 for ; Thu, 12 Apr 2018 13:29:37 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id i66so1581889wmc.1 for ; Thu, 12 Apr 2018 10:29:37 -0700 (PDT) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 7sor1873236wrp.21.2018.04.12.10.29.35 for (Google Transport Security); Thu, 12 Apr 2018 10:29:35 -0700 (PDT) From: Andrey Konovalov Subject: [PATCH] kasan: add no_sanitize attribute for clang builds Date: Thu, 12 Apr 2018 19:29:31 +0200 Message-Id: <4ad725cc903f8534f8c8a60f0daade5e3d674f8d.1523554166.git.andreyknvl@google.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrew Morton , David Rientjes , Thomas Gleixner , Ingo Molnar , David Woodhouse , Andrey Konovalov , Will Deacon , Greg Kroah-Hartman , Paul Lawrence , Sandipan Das , Kees Cook , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: Kostya Serebryany KASAN uses the __no_sanitize_address macro to disable instrumentation of particular functions. Right now it's defined only for GCC build, which causes false positives when clang is used. This patch adds a definition for clang. Note, that clang's revision 329612 or higher is required. Signed-off-by: Andrey Konovalov --- include/linux/compiler-clang.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index ceb96ecab96e..5a1d8580febe 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -25,6 +25,11 @@ #define __SANITIZE_ADDRESS__ #endif +#ifdef CONFIG_KASAN +#undef __no_sanitize_address +#define __no_sanitize_address __attribute__((no_sanitize("address"))) +#endif + /* Clang doesn't have a way to turn it off per-function, yet. */ #ifdef __noretpoline #undef __noretpoline -- 2.17.0.484.g0c8726318c-goog