1 From ae978009fc013e3166c9f523f8b17e41a3c0286e Mon Sep 17 00:00:00 2001
2 From: Kees Cook <keescook@chromium.org>
3 Date: Sun, 6 Feb 2022 09:12:50 -0800
4 Subject: gcc-plugins/stackleak: Ignore .noinstr.text and .entry.text
6 From: Kees Cook <keescook@chromium.org>
8 commit ae978009fc013e3166c9f523f8b17e41a3c0286e upstream.
10 The .noinstr.text section functions may not have "current()" sanely
11 available. Similarly true for .entry.text, though such a check is
12 currently redundant. Add a check for both. In an x86_64 defconfig build,
13 the following functions no longer receive stackleak instrumentation:
15 __do_fast_syscall_32()
19 exc_general_protection()
22 Suggested-by: Peter Zijlstra <peterz@infradead.org>
23 Cc: Alexander Popov <alex.popov@linux.com>
24 Signed-off-by: Kees Cook <keescook@chromium.org>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 scripts/gcc-plugins/stackleak_plugin.c | 4 ++++
28 1 file changed, 4 insertions(+)
30 --- a/scripts/gcc-plugins/stackleak_plugin.c
31 +++ b/scripts/gcc-plugins/stackleak_plugin.c
32 @@ -463,6 +463,10 @@ static bool stackleak_gate(void)
34 if (STRING_EQUAL(section, ".meminit.text"))
36 + if (STRING_EQUAL(section, ".noinstr.text"))
38 + if (STRING_EQUAL(section, ".entry.text"))
42 return track_frame_size >= 0;