gcc-plugins/stackleak: Avoid .head.text section
authorArd Biesheuvel <ardb@kernel.org>
Thu, 28 Mar 2024 06:42:57 +0000 (07:42 +0100)
committerKees Cook <keescook@chromium.org>
Wed, 3 Apr 2024 21:35:49 +0000 (14:35 -0700)
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>
Link: https://lore.kernel.org/r/20240328064256.2358634-2-ardb+git@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>
scripts/gcc-plugins/stackleak_plugin.c

index c5c2ce113c9232c331c4ebac2ba4384a24424640..d20c47d21ad8352973c93ccefc7b0931e93de545 100644 (file)
@@ -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;