Skip to contentSkip to conversation

kexec broken with STACKLEAK enabled

PATCH Applied Arvind Sankar 3 participants 6 messages Sep 22, 2019 – Sep 23, 2019 x86

lore
Share & tools
lore
#0 lore raw

Hi, since commit b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS) kexec is broken if GCC_PLUGIN_STACKLEAK is enabled, as the purgatory contains undefined references to stackleak_track_stack.

Attempting to load a kexec kernel results in an error:

kexec: Undefined symbol: stackleak_track_stack
kexec-bzImage64: Loading purgatory failed

Adding $(DISABLE_STACKLEAK_PLUGIN) to PURGATORY_CFLAGS in arch/x86/purgatory/Makefile fixes this.

Not sure if that's the best fix or if other architectures also require a similar one.

Thanks.

#1 lore raw
Quoted 6 lines · Arvind Sankar

Hi, since commit b059f801a937 (x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS) kexec is broken if GCC_PLUGIN_STACKLEAK is enabled, as the purgatory contains undefined references to stackleak_track_stack.

Quoted 7 lines

Attempting to load a kexec kernel results in an error:

kexec: Undefined symbol: stackleak_track_stack
kexec-bzImage64: Loading purgatory failed

Adding $(DISABLE_STACKLEAK_PLUGIN) to PURGATORY_CFLAGS in arch/x86/purgatory/Makefile fixes this.

Hi Arvind,
Thanks for the report. That sounds like a straightforward fix. Would you like to send a patch for that? I'd be happy to help review it.

Quoted 3 lines

Not sure if that's the best fix or if other architectures also require a similar one.

The commit you reference should be x86 only.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw

PATCH 1/1 x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN)

Since commit b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS") kexec breaks is GCC_PLUGIN_STACKLEAK is enabled, as the purgatory contains undefined references to stackleak_track_stack. Attempting to load a kexec kernel results in:
kexec: Undefined symbol: stackleak_track_stack
kexec-bzImage64: Loading purgatory failed

Fix this by disabling the stackleak plugin for purgatory.

Fixes b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/x86/purgatory/Makefile +1 -0
index 527749066d31..fb4ee5444379 100644
@@ -25,6 +25,7 @@ KCOV_INSTRUMENT := n
 
 PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
 PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
+PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN)
 
 # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
 # in turn leaves some undefined symbols like __fentry__ in purgatory and not
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN)

Quoted 8 lines · Arvind Sankar

Since commit b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS") kexec breaks is GCC_PLUGIN_STACKLEAK is enabled, as the purgatory contains undefined references to stackleak_track_stack. Attempting to load a kexec kernel results in:
kexec: Undefined symbol: stackleak_track_stack
kexec-bzImage64: Loading purgatory failed

Quoted 4 lines

Fix this by disabling the stackleak plugin for purgatory.

Fixes b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")

(Sorry for the fallout from b059f801a937, but this is giving us a pretty good idea about what "runtime" requirements certain configs have. It would be cool to eventually have some kind of kexec test case that folks could run in QEMU).

Quoted 19 lines
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/x86/purgatory/Makefile +1 -1
index 527749066d31..fb4ee5444379 100644
@@ -25,6 +25,7 @@ KCOV_INSTRUMENT := n
 
 PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
 PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
+PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN)
 
 # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
 # in turn leaves some undefined symbols like __fentry__ in purgatory and not
--

2.21.0

Signature · 2 lines
Thanks,
~Nick Desaulniers
merge bot Applied
#4 lore raw

[tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory

In reply to Arvind Sankar
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     ca14c996afe7228ff9b480cf225211cc17212688
Gitweb:        https://git.kernel.org/tip/ca14c996afe7228ff9b480cf225211cc17212688
Author:        Arvind Sankar <[email protected]>
AuthorDate:    Mon, 23 Sep 2019 13:17:54 -04:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 23 Sep 2019 19:48:02 +02:00

x86/purgatory: Disable the stackleak GCC plugin for the purgatory

Since commit:

b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")

kexec breaks if GCC_PLUGIN_STACKLEAK=y is enabled, as the purgatory contains undefined references to stackleak_track_stack.

Attempting to load a kexec kernel results in this failure:

kexec: Undefined symbol: stackleak_track_stack
kexec-bzImage64: Loading purgatory failed

Fix this by disabling the stackleak plugin for the purgatory.

Cc Borislav Petkov <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/x86/purgatory/Makefile +1 -0
index 10fb42d..b81b517 100644
@@ -23,6 +23,7 @@ KCOV_INSTRUMENT := n
 
 PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
 PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
+PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN)
 
 # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
 # in turn leaves some undefined symbols like __fentry__ in purgatory and not
merge bot Applied
#5 lore raw

[tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory

In reply to Arvind Sankar
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     ca14c996afe7228ff9b480cf225211cc17212688
Gitweb:        https://git.kernel.org/tip/ca14c996afe7228ff9b480cf225211cc17212688
Author:        Arvind Sankar <[email protected]>
AuthorDate:    Mon, 23 Sep 2019 13:17:54 -04:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 23 Sep 2019 19:48:02 +02:00

x86/purgatory: Disable the stackleak GCC plugin for the purgatory

Since commit:

b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")

kexec breaks if GCC_PLUGIN_STACKLEAK=y is enabled, as the purgatory contains undefined references to stackleak_track_stack.

Attempting to load a kexec kernel results in this failure:

kexec: Undefined symbol: stackleak_track_stack
kexec-bzImage64: Loading purgatory failed

Fix this by disabling the stackleak plugin for the purgatory.

Cc Borislav Petkov <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/x86/purgatory/Makefile +1 -0
index 10fb42d..b81b517 100644
@@ -23,6 +23,7 @@ KCOV_INSTRUMENT := n
 
 PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
 PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
+PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN)
 
 # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
 # in turn leaves some undefined symbols like __fentry__ in purgatory and not