Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753658AbdGJItP (ORCPT ); Mon, 10 Jul 2017 04:49:15 -0400 Received: from mail-oi0-f50.google.com ([209.85.218.50]:33230 "EHLO mail-oi0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753485AbdGJItN (ORCPT ); Mon, 10 Jul 2017 04:49:13 -0400 MIME-Version: 1.0 In-Reply-To: <20170706220114.142438-5-ghackmann@google.com> References: <20170706220114.142438-1-ghackmann@google.com> <20170706220114.142438-5-ghackmann@google.com> From: Dmitry Vyukov Date: Mon, 10 Jul 2017 10:48:46 +0200 Message-ID: Subject: Re: [PATCH 4/4] kasan: add compiler support for clang To: Greg Hackmann Cc: Andrey Ryabinin , Alexander Potapenko , Masahiro Yamada , Michal Marek , LKML , kasan-dev , "linux-mm@kvack.org" , "open list:KERNEL BUILD + fi..." , Matthias Kaehlcke , Michael Davidson Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1044 Lines: 31 On Fri, Jul 7, 2017 at 12:01 AM, Greg Hackmann wrote: > 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 > --- > include/linux/compiler-clang.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > index d614c5ea1b5e..8153f793b22a 100644 > --- a/include/linux/compiler-clang.h > +++ b/include/linux/compiler-clang.h > @@ -23,3 +23,13 @@ > */ > #undef inline > #define inline inline __attribute__((unused)) notrace > + > +/* 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 Reviewed-by: Dmitry Vyukov