public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18
@ 2026-01-14 23:27 Nathan Chancellor
  2026-01-27 14:37 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2026-01-14 23:27 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Tony Luck, Borislav Petkov, Hanjun Guo, Mauro Carvalho Chehab,
	Shuai Xue, Len Brown, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-acpi, llvm, patches, Nathan Chancellor

After a recent innocuous change to drivers/acpi/apei/ghes.c, building
ARCH=arm64 allmodconfig with clang-17 or older (which has both
CONFIG_KASAN=y and CONFIG_WERROR=y) fails with:

  drivers/acpi/apei/ghes.c:902:13: error: stack frame size (2768) exceeds limit (2048) in 'ghes_do_proc' [-Werror,-Wframe-larger-than]
    902 | static void ghes_do_proc(struct ghes *ghes,
        |             ^

A KASAN pass that removes unneeded stack instrumentation, enabled by
default in clang-18 [1], drastically improves stack usage in this case.

To avoid the warning in the common allmodconfig case when it can break
the build, disable KASAN for ghes.o when compile testing with clang-17
and older. Disabling KASAN outright may hide legitimate runtime issues,
so live with the warning in that case; the user can either increase the
frame warning limit or disable -Werror, which they should probably do
when debugging with KASAN anyways.

Closes: https://github.com/ClangBuiltLinux/linux/issues/2148
Link: https://github.com/llvm/llvm-project/commit/51fbab134560ece663517bf1e8c2a30300d08f1a [1]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/acpi/apei/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/apei/Makefile b/drivers/acpi/apei/Makefile
index 2c474e6477e1..346cdf0a0ef9 100644
--- a/drivers/acpi/apei/Makefile
+++ b/drivers/acpi/apei/Makefile
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_ACPI_APEI)		+= apei.o
 obj-$(CONFIG_ACPI_APEI_GHES)	+= ghes.o
+# clang versions prior to 18 may blow out the stack with KASAN
+ifeq ($(CONFIG_COMPILE_TEST)_$(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_y_)
+KASAN_SANITIZE_ghes.o := n
+endif
 obj-$(CONFIG_ACPI_APEI_EINJ)	+= einj.o
 einj-y				:= einj-core.o
 einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o

---
base-commit: 4c96ec13fcaee154368f19887f7f84985ef605bc
change-id: 20260114-ghes-avoid-wflt-clang-older-than-18-504259c709a6

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18
  2026-01-14 23:27 [PATCH] ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18 Nathan Chancellor
@ 2026-01-27 14:37 ` Rafael J. Wysocki
  2026-01-27 21:47   ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-01-27 14:37 UTC (permalink / raw)
  To: Nathan Chancellor, Tony Luck, Borislav Petkov
  Cc: Hanjun Guo, Mauro Carvalho Chehab, Shuai Xue, Len Brown,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-acpi, llvm,
	patches

On Thu, Jan 15, 2026 at 12:27 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> After a recent innocuous change to drivers/acpi/apei/ghes.c, building
> ARCH=arm64 allmodconfig with clang-17 or older (which has both
> CONFIG_KASAN=y and CONFIG_WERROR=y) fails with:
>
>   drivers/acpi/apei/ghes.c:902:13: error: stack frame size (2768) exceeds limit (2048) in 'ghes_do_proc' [-Werror,-Wframe-larger-than]
>     902 | static void ghes_do_proc(struct ghes *ghes,
>         |             ^
>
> A KASAN pass that removes unneeded stack instrumentation, enabled by
> default in clang-18 [1], drastically improves stack usage in this case.
>
> To avoid the warning in the common allmodconfig case when it can break
> the build, disable KASAN for ghes.o when compile testing with clang-17
> and older. Disabling KASAN outright may hide legitimate runtime issues,
> so live with the warning in that case; the user can either increase the
> frame warning limit or disable -Werror, which they should probably do
> when debugging with KASAN anyways.
>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2148
> Link: https://github.com/llvm/llvm-project/commit/51fbab134560ece663517bf1e8c2a30300d08f1a [1]
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/acpi/apei/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/acpi/apei/Makefile b/drivers/acpi/apei/Makefile
> index 2c474e6477e1..346cdf0a0ef9 100644
> --- a/drivers/acpi/apei/Makefile
> +++ b/drivers/acpi/apei/Makefile
> @@ -1,6 +1,10 @@
>  # SPDX-License-Identifier: GPL-2.0
>  obj-$(CONFIG_ACPI_APEI)                += apei.o
>  obj-$(CONFIG_ACPI_APEI_GHES)   += ghes.o
> +# clang versions prior to 18 may blow out the stack with KASAN
> +ifeq ($(CONFIG_COMPILE_TEST)_$(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_y_)
> +KASAN_SANITIZE_ghes.o := n
> +endif
>  obj-$(CONFIG_ACPI_APEI_EINJ)   += einj.o
>  einj-y                         := einj-core.o
>  einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o
>
> ---

I'm inclined to apply this for 6.20/7.0 unless someone has any
particular heartburn related to it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18
  2026-01-27 14:37 ` Rafael J. Wysocki
@ 2026-01-27 21:47   ` Nathan Chancellor
  2026-01-28 20:36     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2026-01-27 21:47 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Tony Luck, Borislav Petkov, Hanjun Guo, Mauro Carvalho Chehab,
	Shuai Xue, Len Brown, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-acpi, llvm, patches

On Tue, Jan 27, 2026 at 03:37:58PM +0100, Rafael J. Wysocki wrote:
> On Thu, Jan 15, 2026 at 12:27 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > After a recent innocuous change to drivers/acpi/apei/ghes.c, building
> > ARCH=arm64 allmodconfig with clang-17 or older (which has both
> > CONFIG_KASAN=y and CONFIG_WERROR=y) fails with:
> >
> >   drivers/acpi/apei/ghes.c:902:13: error: stack frame size (2768) exceeds limit (2048) in 'ghes_do_proc' [-Werror,-Wframe-larger-than]
> >     902 | static void ghes_do_proc(struct ghes *ghes,
> >         |             ^
> >
> > A KASAN pass that removes unneeded stack instrumentation, enabled by
> > default in clang-18 [1], drastically improves stack usage in this case.
> >
> > To avoid the warning in the common allmodconfig case when it can break
> > the build, disable KASAN for ghes.o when compile testing with clang-17
> > and older. Disabling KASAN outright may hide legitimate runtime issues,
> > so live with the warning in that case; the user can either increase the
> > frame warning limit or disable -Werror, which they should probably do
> > when debugging with KASAN anyways.
> >
> > Closes: https://github.com/ClangBuiltLinux/linux/issues/2148
> > Link: https://github.com/llvm/llvm-project/commit/51fbab134560ece663517bf1e8c2a30300d08f1a [1]
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >  drivers/acpi/apei/Makefile | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/acpi/apei/Makefile b/drivers/acpi/apei/Makefile
> > index 2c474e6477e1..346cdf0a0ef9 100644
> > --- a/drivers/acpi/apei/Makefile
> > +++ b/drivers/acpi/apei/Makefile
> > @@ -1,6 +1,10 @@
> >  # SPDX-License-Identifier: GPL-2.0
> >  obj-$(CONFIG_ACPI_APEI)                += apei.o
> >  obj-$(CONFIG_ACPI_APEI_GHES)   += ghes.o
> > +# clang versions prior to 18 may blow out the stack with KASAN
> > +ifeq ($(CONFIG_COMPILE_TEST)_$(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_y_)
> > +KASAN_SANITIZE_ghes.o := n
> > +endif
> >  obj-$(CONFIG_ACPI_APEI_EINJ)   += einj.o
> >  einj-y                         := einj-core.o
> >  einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o
> >
> > ---
> 
> I'm inclined to apply this for 6.20/7.0 unless someone has any
> particular heartburn related to it.

I think taking it for next cycle is fine, I can just apply this to our
CI until it makes its way to Linus. Could you stick a

  Cc: stable@vger.kernel.org

on the patch in that case so that it can go back to 6.18 after the
initial flurry of the merge window?

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18
  2026-01-27 21:47   ` Nathan Chancellor
@ 2026-01-28 20:36     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-01-28 20:36 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Rafael J. Wysocki, Tony Luck, Borislav Petkov, Hanjun Guo,
	Mauro Carvalho Chehab, Shuai Xue, Len Brown, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-acpi, llvm, patches

On Tue, Jan 27, 2026 at 10:47 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Tue, Jan 27, 2026 at 03:37:58PM +0100, Rafael J. Wysocki wrote:
> > On Thu, Jan 15, 2026 at 12:27 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > After a recent innocuous change to drivers/acpi/apei/ghes.c, building
> > > ARCH=arm64 allmodconfig with clang-17 or older (which has both
> > > CONFIG_KASAN=y and CONFIG_WERROR=y) fails with:
> > >
> > >   drivers/acpi/apei/ghes.c:902:13: error: stack frame size (2768) exceeds limit (2048) in 'ghes_do_proc' [-Werror,-Wframe-larger-than]
> > >     902 | static void ghes_do_proc(struct ghes *ghes,
> > >         |             ^
> > >
> > > A KASAN pass that removes unneeded stack instrumentation, enabled by
> > > default in clang-18 [1], drastically improves stack usage in this case.
> > >
> > > To avoid the warning in the common allmodconfig case when it can break
> > > the build, disable KASAN for ghes.o when compile testing with clang-17
> > > and older. Disabling KASAN outright may hide legitimate runtime issues,
> > > so live with the warning in that case; the user can either increase the
> > > frame warning limit or disable -Werror, which they should probably do
> > > when debugging with KASAN anyways.
> > >
> > > Closes: https://github.com/ClangBuiltLinux/linux/issues/2148
> > > Link: https://github.com/llvm/llvm-project/commit/51fbab134560ece663517bf1e8c2a30300d08f1a [1]
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > >  drivers/acpi/apei/Makefile | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/acpi/apei/Makefile b/drivers/acpi/apei/Makefile
> > > index 2c474e6477e1..346cdf0a0ef9 100644
> > > --- a/drivers/acpi/apei/Makefile
> > > +++ b/drivers/acpi/apei/Makefile
> > > @@ -1,6 +1,10 @@
> > >  # SPDX-License-Identifier: GPL-2.0
> > >  obj-$(CONFIG_ACPI_APEI)                += apei.o
> > >  obj-$(CONFIG_ACPI_APEI_GHES)   += ghes.o
> > > +# clang versions prior to 18 may blow out the stack with KASAN
> > > +ifeq ($(CONFIG_COMPILE_TEST)_$(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_y_)
> > > +KASAN_SANITIZE_ghes.o := n
> > > +endif
> > >  obj-$(CONFIG_ACPI_APEI_EINJ)   += einj.o
> > >  einj-y                         := einj-core.o
> > >  einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o
> > >
> > > ---
> >
> > I'm inclined to apply this for 6.20/7.0 unless someone has any
> > particular heartburn related to it.
>
> I think taking it for next cycle is fine, I can just apply this to our
> CI until it makes its way to Linus. Could you stick a
>
>   Cc: stable@vger.kernel.org
>
> on the patch in that case so that it can go back to 6.18 after the
> initial flurry of the merge window?

Applied with a Cc: stable tag, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-28 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14 23:27 [PATCH] ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18 Nathan Chancellor
2026-01-27 14:37 ` Rafael J. Wysocki
2026-01-27 21:47   ` Nathan Chancellor
2026-01-28 20:36     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox