[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202507291738.262CEF2095@keescook>
Date: Tue, 29 Jul 2025 17:39:35 -0700
From: Kees Cook <kees@...nel.org>
To: Linus Torvalds <torvalds@...uxfoundation.org>
Cc: kernel test robot <lkp@...el.com>,
syzbot+5245cb609175fb6e8122@...kaller.appspotmail.com,
Miguel Ojeda <ojeda@...nel.org>,
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>,
Marco Elver <elver@...gle.com>,
Hou Wenlong <houwenlong.hwl@...group.com>,
"Kirill A . Shutemov" <kas@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Wei Yang <richard.weiyang@...il.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Arnd Bergmann <arnd@...db.de>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Jan Hendrik Farr <kernel@...rr.cc>, Uros Bizjak <ubizjak@...il.com>,
Marc Herbert <Marc.Herbert@...ux.intel.com>,
Yafang Shao <laoar.shao@...il.com>, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] compiler_types: Provide __no_kstack_erase to disable
coverage only on Clang
On Tue, Jul 29, 2025 at 04:41:00PM -0700, Kees Cook wrote:
> In order to support Clang's stack depth tracking (for Linux's kstack_erase
> feature), the coverage sanitizer needed to be disabled for __init (and
> __head) section code. Doing this universally (i.e. for GCC too) created
> a number of unexpected problems, ranging from changes to inlining logic
> to failures to DCE code on earlier GCC versions.
>
> Since this change is only needed for Clang, specialize it so that GCC
> doesn't see the change as it isn't needed there (the GCC implementation
> of kstack_erase uses a GCC plugin that removes stack depth tracking
> instrumentation from __init sections during a late pass in the IR).
>
> Successfully build and boot tested with GCC 12 and Clang 22.
>
> Fixes: 381a38ea53d2 ("init.h: Disable sanitizer coverage for __init and __head")
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202507270258.neWuiXLd-lkp@intel.com/
> Reported-by: syzbot+5245cb609175fb6e8122@...kaller.appspotmail.com
> Closes: https://lore.kernel.org/all/6888d004.a00a0220.26d0e1.0004.GAE@google.com/
> Signed-off-by: Kees Cook <kees@...nel.org>
I've now sent the PR that includes this fix:
https://lore.kernel.org/lkml/202507291728.51BAA26@keescook/
Thank you everyone for suffering through the mess I made! :P
-Kees
--
Kees Cook
Powered by blists - more mailing lists