[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACT4Y+betRmieWEHBdEf=gOLhWiNVRH5CSDeN6ykBtoP1GrzLA@mail.gmail.com>
Date: Thu, 8 May 2025 14:25:13 +0200
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Marco Elver <elver@...gle.com>
Cc: Kees Cook <kees@...nel.org>, Alexander Potapenko <glider@...gle.com>,
Aleksandr Nogikh <nogikh@...gle.com>, Arnd Bergmann <arnd@...db.de>,
Andrey Konovalov <andreyknvl@...il.com>, Andrey Ryabinin <ryabinin.a.a@...il.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Ard Biesheuvel <ardb@...nel.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>, Hou Wenlong <houwenlong.hwl@...group.com>,
Andrew Morton <akpm@...ux-foundation.org>, Masahiro Yamada <masahiroy@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, Luis Chamberlain <mcgrof@...nel.org>,
Sami Tolvanen <samitolvanen@...gle.com>, Christophe Leroy <christophe.leroy@...roup.eu>,
kasan-dev@...glegroups.com, "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Christoph Hellwig <hch@....de>, Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, linux-efi@...r.kernel.org,
linux-hardening@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kselftest@...r.kernel.org,
sparclinux@...r.kernel.org, llvm@...ts.linux.dev,
syzkaller <syzkaller@...glegroups.com>
Subject: Re: [PATCH 2/8] init.h: Disable sanitizer coverage for __init and __head
On Thu, 8 May 2025 at 14:23, Marco Elver <elver@...gle.com> wrote:
>
> +Cc KCOV maintainers
>
> On Wed, 7 May 2025 at 20:16, Kees Cook <kees@...nel.org> wrote:
> >
> > While __noinstr already contained __no_sanitize_coverage, it needs to
> > be added to __init and __head section markings to support the Clang
> > implementation of CONFIG_STACKLEAK. This is to make sure the stack depth
> > tracking callback is not executed in unsupported contexts.
> >
> > The other sanitizer coverage options (trace-pc and trace-cmp) aren't
> > needed in __head nor __init either ("We are interested in code coverage
> > as a function of a syscall inputs"[1]), so this appears safe to disable
> > for them as well.
>
> @ Dmitry, Aleksandr - Will this produce some unwanted side-effects for
> syzbot? I also think it's safe, but just double checking.
I do not see any problems with this.
> > Link: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/kcov.c?h=v6.14#n179 [1]
> > Signed-off-by: Kees Cook <kees@...nel.org>
>
> Acked-by: Marco Elver <elver@...gle.com>
>
> > ---
> > Cc: Marco Elver <elver@...gle.com>
> > Cc: Andrey Konovalov <andreyknvl@...il.com>
> > Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>
> > Cc: Thomas Gleixner <tglx@...utronix.de>
> > Cc: Ingo Molnar <mingo@...hat.com>
> > Cc: Borislav Petkov <bp@...en8.de>
> > Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> > Cc: <x86@...nel.org>
> > Cc: "H. Peter Anvin" <hpa@...or.com>
> > Cc: Ard Biesheuvel <ardb@...nel.org>
> > Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
> > Cc: Hou Wenlong <houwenlong.hwl@...group.com>
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Cc: Masahiro Yamada <masahiroy@...nel.org>
> > Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>
> > Cc: Luis Chamberlain <mcgrof@...nel.org>
> > Cc: Sami Tolvanen <samitolvanen@...gle.com>
> > Cc: Arnd Bergmann <arnd@...db.de>
> > Cc: Christophe Leroy <christophe.leroy@...roup.eu>
> > Cc: <kasan-dev@...glegroups.com>
> > ---
> > arch/x86/include/asm/init.h | 2 +-
> > include/linux/init.h | 4 +++-
> > 2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h
> > index 8b1b1abcef15..6bfdaeddbae8 100644
> > --- a/arch/x86/include/asm/init.h
> > +++ b/arch/x86/include/asm/init.h
> > @@ -5,7 +5,7 @@
> > #if defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 170000
> > #define __head __section(".head.text") __no_sanitize_undefined __no_stack_protector
> > #else
> > -#define __head __section(".head.text") __no_sanitize_undefined
> > +#define __head __section(".head.text") __no_sanitize_undefined __no_sanitize_coverage
> > #endif
> >
> > struct x86_mapping_info {
> > diff --git a/include/linux/init.h b/include/linux/init.h
> > index ee1309473bc6..c65a050d52a7 100644
> > --- a/include/linux/init.h
> > +++ b/include/linux/init.h
> > @@ -49,7 +49,9 @@
> >
> > /* These are for everybody (although not all archs will actually
> > discard it in modules) */
> > -#define __init __section(".init.text") __cold __latent_entropy __noinitretpoline
> > +#define __init __section(".init.text") __cold __latent_entropy \
> > + __noinitretpoline \
> > + __no_sanitize_coverage
> > #define __initdata __section(".init.data")
> > #define __initconst __section(".init.rodata")
> > #define __exitdata __section(".exit.data")
> > --
> > 2.34.1
> >
Powered by blists - more mailing lists