All of lore.kernel.org
 help / color / mirror / Atom feed
* kexec broken with STACKLEAK enabled
@ 2019-09-22 17:32 Arvind Sankar
  2019-09-23 16:15 ` Nick Desaulniers
  0 siblings, 1 reply; 6+ messages in thread
From: Arvind Sankar @ 2019-09-22 17:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Nick Desaulniers

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.

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

* Re: kexec broken with STACKLEAK enabled
  2019-09-22 17:32 kexec broken with STACKLEAK enabled Arvind Sankar
@ 2019-09-23 16:15 ` Nick Desaulniers
  2019-09-23 17:17   ` [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN) Arvind Sankar
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Desaulniers @ 2019-09-23 16:15 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: LKML, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)

On Sun, Sep 22, 2019 at 10:32 AM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> 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.

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.

>
> 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.
-- 
Thanks,
~Nick Desaulniers

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

* [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN)
  2019-09-23 16:15 ` Nick Desaulniers
@ 2019-09-23 17:17   ` Arvind Sankar
  2019-09-23 17:25     ` Nick Desaulniers
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arvind Sankar @ 2019-09-23 17:17 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Arvind Sankar, LKML, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)

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")
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 527749066d31..fb4ee5444379 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -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


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

* Re: [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN)
  2019-09-23 17:17   ` [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN) Arvind Sankar
@ 2019-09-23 17:25     ` Nick Desaulniers
  2019-09-23 17:52     ` [tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory tip-bot2 for Arvind Sankar
  2019-09-23 17:52     ` tip-bot2 for Arvind Sankar
  2 siblings, 0 replies; 6+ messages in thread
From: Nick Desaulniers @ 2019-09-23 17:25 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: LKML, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	Ard Biesheuvel

On Mon, Sep 23, 2019 at 10:17 AM Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> 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")
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
(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).

> ---
>  arch/x86/purgatory/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
> index 527749066d31..fb4ee5444379 100644
> --- a/arch/x86/purgatory/Makefile
> +++ b/arch/x86/purgatory/Makefile
> @@ -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
>


-- 
Thanks,
~Nick Desaulniers

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

* [tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory
  2019-09-23 17:17   ` [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN) Arvind Sankar
  2019-09-23 17:25     ` Nick Desaulniers
@ 2019-09-23 17:52     ` tip-bot2 for Arvind Sankar
  2019-09-23 17:52     ` tip-bot2 for Arvind Sankar
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Arvind Sankar @ 2019-09-23 17:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Arvind Sankar, Nick Desaulniers, Borislav Petkov, H. Peter Anvin,
	Linus Torvalds, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	linux-kernel

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 <nivedita@alum.mit.edu>
AuthorDate:    Mon, 23 Sep 2019 13:17:54 -04:00
Committer:     Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
Link: https://lkml.kernel.org/r/20190923171753.GA2252517@rani.riverdale.lan
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 10fb42d..b81b517 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -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

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

* [tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory
  2019-09-23 17:17   ` [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN) Arvind Sankar
  2019-09-23 17:25     ` Nick Desaulniers
  2019-09-23 17:52     ` [tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory tip-bot2 for Arvind Sankar
@ 2019-09-23 17:52     ` tip-bot2 for Arvind Sankar
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Arvind Sankar @ 2019-09-23 17:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Arvind Sankar, Nick Desaulniers, Borislav Petkov, H. Peter Anvin,
	Linus Torvalds, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	linux-kernel

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 <nivedita@alum.mit.edu>
AuthorDate:    Mon, 23 Sep 2019 13:17:54 -04:00
Committer:     Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS")
Link: https://lkml.kernel.org/r/20190923171753.GA2252517@rani.riverdale.lan
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/purgatory/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 10fb42d..b81b517 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -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

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

end of thread, other threads:[~2019-09-23 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22 17:32 kexec broken with STACKLEAK enabled Arvind Sankar
2019-09-23 16:15 ` Nick Desaulniers
2019-09-23 17:17   ` [PATCH] x86/purgatory: Add $(DISABLE_STACKLEAK_PLUGIN) Arvind Sankar
2019-09-23 17:25     ` Nick Desaulniers
2019-09-23 17:52     ` [tip: x86/urgent] x86/purgatory: Disable the stackleak GCC plugin for the purgatory tip-bot2 for Arvind Sankar
2019-09-23 17:52     ` tip-bot2 for Arvind Sankar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.