summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2022-02-06 09:12:50 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-13 13:01:47 +0200
commit7e0bd07ce9655656ad0c55f5dfff563eecffa82f (patch)
tree433590e670a7c5232dc16ae1531af73b6fb88069
parent2d154a54c58f9c8375bfbea9f7e51ba3bfb2e43a (diff)
downloadlinux-stable-7e0bd07ce9655656ad0c55f5dfff563eecffa82f.tar.gz
linux-stable-7e0bd07ce9655656ad0c55f5dfff563eecffa82f.tar.bz2
linux-stable-7e0bd07ce9655656ad0c55f5dfff563eecffa82f.zip
gcc-plugins/stackleak: Ignore .noinstr.text and .entry.text
commit ae978009fc013e3166c9f523f8b17e41a3c0286e upstream. The .noinstr.text section functions may not have "current()" sanely available. Similarly true for .entry.text, though such a check is currently redundant. Add a check for both. In an x86_64 defconfig build, the following functions no longer receive stackleak instrumentation: __do_fast_syscall_32() do_int80_syscall_32() do_machine_check() do_syscall_64() exc_general_protection() fixup_bad_iret() Suggested-by: Peter Zijlstra <peterz@infradead.org> Cc: Alexander Popov <alex.popov@linux.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--scripts/gcc-plugins/stackleak_plugin.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c
index b04aa8e91a41..42f0252ee2a4 100644
--- a/scripts/gcc-plugins/stackleak_plugin.c
+++ b/scripts/gcc-plugins/stackleak_plugin.c
@@ -463,6 +463,10 @@ static bool stackleak_gate(void)
return false;
if (STRING_EQUAL(section, ".meminit.text"))
return false;
+ if (STRING_EQUAL(section, ".noinstr.text"))
+ return false;
+ if (STRING_EQUAL(section, ".entry.text"))
+ return false;
}
return track_frame_size >= 0;