Skip to content

Commit dcb85f8

Browse files
keestorvalds
authored andcommitted
gcc-plugins/stackleak: Use noinstr in favor of notrace
While the stackleak plugin was already using notrace, objtool is now a bit more picky. Update the notrace uses to noinstr. Silences the following objtool warnings when building with: CONFIG_DEBUG_ENTRY=y CONFIG_STACK_VALIDATION=y CONFIG_VMLINUX_VALIDATION=y CONFIG_GCC_PLUGIN_STACKLEAK=y vmlinux.o: warning: objtool: do_syscall_64()+0x9: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: do_int80_syscall_32()+0x9: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: exc_general_protection()+0x22: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: fixup_bad_iret()+0x20: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: do_machine_check()+0x27: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: .text+0x5346e: call to stackleak_erase() leaves .noinstr.text section vmlinux.o: warning: objtool: .entry.text+0x143: call to stackleak_erase() leaves .noinstr.text section vmlinux.o: warning: objtool: .entry.text+0x10eb: call to stackleak_erase() leaves .noinstr.text section vmlinux.o: warning: objtool: .entry.text+0x17f9: call to stackleak_erase() leaves .noinstr.text section Note that the plugin's addition of calls to stackleak_track_stack() from noinstr functions is expected to be safe, as it isn't runtime instrumentation and is self-contained. Cc: Alexander Popov <[email protected]> Suggested-by: Peter Zijlstra <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent eb2eb51 commit dcb85f8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

kernel/stackleak.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ late_initcall(stackleak_sysctls_init);
7070
#define skip_erasing() false
7171
#endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */
7272

73-
asmlinkage void notrace stackleak_erase(void)
73+
asmlinkage void noinstr stackleak_erase(void)
7474
{
7575
/* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */
7676
unsigned long kstack_ptr = current->lowest_stack;
@@ -124,9 +124,8 @@ asmlinkage void notrace stackleak_erase(void)
124124
/* Reset the 'lowest_stack' value for the next syscall */
125125
current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
126126
}
127-
NOKPROBE_SYMBOL(stackleak_erase);
128127

129-
void __used __no_caller_saved_registers notrace stackleak_track_stack(void)
128+
void __used __no_caller_saved_registers noinstr stackleak_track_stack(void)
130129
{
131130
unsigned long sp = current_stack_pointer;
132131

0 commit comments

Comments
 (0)