From: Nathan Chancellor <nathan@kernel.org>
To: Kees Cook <kees@kernel.org>
Cc: "Arnd Bergmann" <arnd@arndb.de>, "Will Deacon" <will@kernel.org>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Gavin Shan" <gshan@redhat.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"James Morse" <james.morse@arm.com>,
"Oza Pawandeep" <quic_poza@quicinc.com>,
"Anshuman Khandual" <anshuman.khandual@arm.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Mike Rapoport" <rppt@kernel.org>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Michal Wilczynski" <michal.wilczynski@intel.com>,
"Juergen Gross" <jgross@suse.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Kirill A. Shutemov" <kas@kernel.org>,
"Roger Pau Monne" <roger.pau@citrix.com>,
"David Woodhouse" <dwmw@amazon.co.uk>,
"Usama Arif" <usama.arif@bytedance.com>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
"Thomas Huth" <thuth@redhat.com>,
"Brian Gerst" <brgerst@gmail.com>,
"Marco Elver" <elver@google.com>,
"Andrey Konovalov" <andreyknvl@gmail.com>,
"Andrey Ryabinin" <ryabinin.a.a@gmail.com>,
"Hou Wenlong" <houwenlong.hwl@antgroup.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Nicolas Schier" <nicolas.schier@linux.dev>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"Andy Lutomirski" <luto@kernel.org>,
"Baoquan He" <bhe@redhat.com>, "Alexander Graf" <graf@amazon.com>,
"Changyuan Lyu" <changyuanl@google.com>,
"Paul Moore" <paul@paul-moore.com>,
"James Morris" <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Bibo Mao" <maobibo@loongson.cn>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, x86@kernel.org,
kvm@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
linux-mm@kvack.org, kasan-dev@googlegroups.com,
linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org,
kexec@lists.infradead.org, linux-security-module@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH v4 0/4] stackleak: Support Clang stack depth tracking
Date: Fri, 25 Jul 2025 17:43:13 -0700 [thread overview]
Message-ID: <20250726004313.GA3650901@ax162> (raw)
In-Reply-To: <20250724054419.it.405-kees@kernel.org>
Hi Kees,
On Wed, Jul 23, 2025 at 10:50:24PM -0700, Kees Cook wrote:
> v4:
> - rebase on for-next/hardening tree (took subset of v3 patches)
> - improve commit logs for x86 and arm64 changes (Mike, Will, Ard)
> v3: https://lore.kernel.org/lkml/20250717231756.make.423-kees@kernel.org/
> v2: https://lore.kernel.org/lkml/20250523043251.it.550-kees@kernel.org/
> v1: https://lore.kernel.org/lkml/20250507180852.work.231-kees@kernel.org/
>
> Hi,
>
> These are the remaining changes needed to support Clang stack depth
> tracking for kstack_erase (nee stackleak).
A few build issues that I see when building next-20250725, which seem
related to this series.
1. I see
ld.lld: error: undefined symbol: __sanitizer_cov_stack_depth
>>> referenced by atags_to_fdt.c
>>> arch/arm/boot/compressed/atags_to_fdt.o:(atags_to_fdt)
make[5]: *** [arch/arm/boot/compressed/Makefile:152: arch/arm/boot/compressed/vmlinux] Error 1
when building ARCH=arm allmodconfig on next-20250725. The following diff appears to cure that one.
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index f9075edfd773..f6142946b162 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -9,7 +9,6 @@ OBJS =
HEAD = head.o
OBJS += misc.o decompress.o
-CFLAGS_decompress.o += $(DISABLE_KSTACK_ERASE)
ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
OBJS += debug.o
AFLAGS_head.o += -DDEBUG
@@ -96,7 +95,7 @@ KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
-I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \
- -I$(obj)
+ -I$(obj) $(DISABLE_KSTACK_ERASE)
ccflags-remove-$(CONFIG_FUNCTION_TRACER) += -pg
asflags-y := -DZIMAGE
--
2. I see
kernel/kstack_erase.c:168:2: warning: function with attribute 'no_caller_saved_registers' should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only' [-Wexcessive-regsave]
168 | BUILD_BUG_ON(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE > KSTACK_ERASE_SEARCH_DEPTH);
| ^
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^
include/linux/compiler_types.h:568:2: note: expanded from macro 'compiletime_assert'
568 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:556:2: note: expanded from macro '_compiletime_assert'
556 | __compiletime_assert(condition, msg, prefix, suffix)
| ^
include/linux/compiler_types.h:549:4: note: expanded from macro '__compiletime_assert'
549 | prefix ## suffix(); \
| ^
<scratch space>:97:1: note: expanded from here
97 | __compiletime_assert_521
| ^
kernel/kstack_erase.c:168:2: note: '__compiletime_assert_521' declared here
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^
include/linux/compiler_types.h:568:2: note: expanded from macro 'compiletime_assert'
568 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:556:2: note: expanded from macro '_compiletime_assert'
556 | __compiletime_assert(condition, msg, prefix, suffix)
| ^
include/linux/compiler_types.h:546:26: note: expanded from macro '__compiletime_assert'
546 | __noreturn extern void prefix ## suffix(void) \
| ^
<scratch space>:96:1: note: expanded from here
96 | __compiletime_assert_521
| ^
kernel/kstack_erase.c:172:11: warning: function with attribute 'no_caller_saved_registers' should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only' [-Wexcessive-regsave]
172 | if (sp < current->lowest_stack &&
| ^
arch/x86/include/asm/current.h:28:17: note: expanded from macro 'current'
28 | #define current get_current()
| ^
arch/x86/include/asm/current.h:20:44: note: 'get_current' declared here
20 | static __always_inline struct task_struct *get_current(void)
| ^
kernel/kstack_erase.c:173:37: warning: function with attribute 'no_caller_saved_registers' should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only' [-Wexcessive-regsave]
173 | sp >= stackleak_task_low_bound(current)) {
| ^
arch/x86/include/asm/current.h:28:17: note: expanded from macro 'current'
28 | #define current get_current()
| ^
arch/x86/include/asm/current.h:20:44: note: 'get_current' declared here
20 | static __always_inline struct task_struct *get_current(void)
| ^
when building ARCH=i386 allmodconfig.
3. I see
In file included from kernel/fork.c:96:
include/linux/kstack_erase.h:29:37: error: passing 'const struct task_struct *' to parameter of type 'struct task_struct *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
29 | return (unsigned long)end_of_stack(tsk) + sizeof(unsigned long);
| ^~~
include/linux/sched/task_stack.h:56:63: note: passing argument to parameter 'p' here
56 | static inline unsigned long *end_of_stack(struct task_struct *p)
| ^
when building ARCH=loongarch allmodconfig, which does not support
CONFIG_THREAD_INFO_IN_TASK it seems.
Cheers,
Nathan
next prev parent reply other threads:[~2025-07-26 0:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 5:50 [PATCH v4 0/4] stackleak: Support Clang stack depth tracking Kees Cook
2025-07-24 5:50 ` [PATCH v4 1/4] arm64: Handle KCOV __init vs inline mismatches Kees Cook
2025-07-29 8:10 ` Will Deacon
2025-07-24 5:50 ` [PATCH v4 2/4] x86: " Kees Cook
2025-07-29 8:28 ` Mike Rapoport
2025-07-29 9:34 ` Arnd Bergmann
2025-07-24 5:50 ` [PATCH v4 3/4] init.h: Disable sanitizer coverage for __init and __head Kees Cook
2025-07-24 5:50 ` [PATCH v4 4/4] kstack_erase: Support Clang stack depth tracking Kees Cook
2025-07-24 13:08 ` Nicolas Schier
2025-07-26 0:43 ` Nathan Chancellor [this message]
2025-07-26 6:27 ` [PATCH v4 0/4] stackleak: " Kees Cook
2025-07-26 21:47 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250726004313.GA3650901@ax162 \
--to=nathan@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bhe@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=changyuanl@google.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw@amazon.co.uk \
--cc=elver@google.com \
--cc=gpiccoli@igalia.com \
--cc=graf@amazon.com \
--cc=gshan@redhat.com \
--cc=gustavoars@kernel.org \
--cc=hansg@kernel.org \
--cc=hmh@hmh.eng.br \
--cc=houwenlong.hwl@antgroup.com \
--cc=hpa@zytor.com \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=james.morse@arm.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=jmorris@namei.org \
--cc=justinstitt@google.com \
--cc=kas@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=kees@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=luto@kernel.org \
--cc=maobibo@loongson.cn \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=michal.wilczynski@intel.com \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nicolas.schier@linux.dev \
--cc=paul@paul-moore.com \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=quic_poza@quicinc.com \
--cc=rafael@kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=roger.pau@citrix.com \
--cc=rppt@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=samitolvanen@google.com \
--cc=serge@hallyn.com \
--cc=tglx@linutronix.de \
--cc=thuth@redhat.com \
--cc=usama.arif@bytedance.com \
--cc=viresh.kumar@linaro.org \
--cc=vkuznets@redhat.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).