All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gcc-plugins/stackleak: Avoid .head.text section
@ 2024-03-28  6:42 Ard Biesheuvel
  2024-03-28 21:56 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2024-03-28  6:42 UTC (permalink / raw)
  To: linux-hardening
  Cc: keescook, x86, linux-kernel, kevinloughlin, thomas.lendacky,
	Ard Biesheuvel, kernel test robot

From: Ard Biesheuvel <ardb@kernel.org>

The .head.text section carries the startup code that runs with the MMU
off or with a translation of memory that deviates from the ordinary one.
So avoid instrumentation with the stackleak plugin, which already avoids
.init.text and .noinstr.text entirely.

Fixes: 48204aba801f1b51 ("x86/sme: Move early SME kernel encryption handling into .head.text")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202403221630.2692c998-oliver.sang@intel.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 scripts/gcc-plugins/stackleak_plugin.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c
index c5c2ce113c92..d20c47d21ad8 100644
--- a/scripts/gcc-plugins/stackleak_plugin.c
+++ b/scripts/gcc-plugins/stackleak_plugin.c
@@ -467,6 +467,8 @@ static bool stackleak_gate(void)
 			return false;
 		if (STRING_EQUAL(section, ".entry.text"))
 			return false;
+		if (STRING_EQUAL(section, ".head.text"))
+			return false;
 	}
 
 	return track_frame_size >= 0;
-- 
2.44.0.396.g6e790dbe36-goog


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

* Re: [PATCH] gcc-plugins/stackleak: Avoid .head.text section
  2024-03-28  6:42 [PATCH] gcc-plugins/stackleak: Avoid .head.text section Ard Biesheuvel
@ 2024-03-28 21:56 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2024-03-28 21:56 UTC (permalink / raw)
  To: linux-hardening, Ard Biesheuvel
  Cc: Kees Cook, x86, linux-kernel, kevinloughlin, thomas.lendacky,
	Ard Biesheuvel, kernel test robot

On Thu, 28 Mar 2024 07:42:57 +0100, Ard Biesheuvel wrote:
> The .head.text section carries the startup code that runs with the MMU
> off or with a translation of memory that deviates from the ordinary one.
> So avoid instrumentation with the stackleak plugin, which already avoids
> .init.text and .noinstr.text entirely.
> 
> 

Applied to for-next/hardening, thanks!

[1/1] gcc-plugins/stackleak: Avoid .head.text section
      https://git.kernel.org/kees/c/4ac9a796ada0

Take care,

-- 
Kees Cook


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

end of thread, other threads:[~2024-03-28 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28  6:42 [PATCH] gcc-plugins/stackleak: Avoid .head.text section Ard Biesheuvel
2024-03-28 21:56 ` Kees Cook

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.