lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250727155108.GB1183915@ax162>
Date: Sun, 27 Jul 2025 08:51:08 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	Ingo Molnar <mingo@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Mike Rapoport (Microsoft)" <rppt@...nel.org>,
	Pratyush Yadav <ptyadav@...zon.de>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Coiby Xu <coxu@...hat.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
	Alexander Graf <graf@...zon.com>, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] kstack_erase: Add -mgeneral-regs-only to silence Clang
 warnings

On Sat, Jul 26, 2025 at 02:26:19PM -0700, Kees Cook wrote:
> Once CONFIG_KSTACK_ERASE is enabled with Clang on i386, the build warns:
> 
>   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]
> 
> Add -mgeneral-regs-only for the kstack_erase handler, to make Clang feel
> better (it is effectively a no-op flag for the kernel). No binary
> changes encountered.
> 
> Build & boot tested with Clang 21 on x86_64, and i386.
> Build tested with GCC 14.2.0 on x86_64, i386, arm64, and arm.
> 
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Closes: https://lore.kernel.org/all/20250726004313.GA3650901@ax162
> Signed-off-by: Kees Cook <kees@...nel.org>

Tested-by: Nathan Chancellor <nathan@...nel.org>

> ---
>  kernel/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/Makefile b/kernel/Makefile
> index e4f01f1d4d0c..0ee9afd8b7cf 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile
> @@ -140,6 +140,7 @@ obj-$(CONFIG_RESOURCE_KUNIT_TEST) += resource_kunit.o
>  obj-$(CONFIG_SYSCTL_KUNIT_TEST) += sysctl-test.o
>  
>  CFLAGS_kstack_erase.o += $(DISABLE_KSTACK_ERASE)
> +CFLAGS_kstack_erase.o += $(call cc-option,-mgeneral-regs-only)
>  obj-$(CONFIG_KSTACK_ERASE) += kstack_erase.o
>  KASAN_SANITIZE_kstack_erase.o := n
>  KCSAN_SANITIZE_kstack_erase.o := n
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ