Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

stackleak: add declarations for global functions

With -Wmissing-prototypes enabled, the stackleak code produces a couple of
warnings that have no declarations because they are only called from assembler:

stackleak.c:127:25: error: no previous prototype for 'stackleak_erase' [-Werror=missing-prototypes]
stackleak.c:139:25: error: no previous prototype for 'stackleak_erase_on_task_stack' [-Werror=missing-prototypes]
stackleak.c:151:25: error: no previous prototype for 'stackleak_erase_off_task_stack' [-Werror=missing-prototypes]
stackleak.c:159:49: error: no previous prototype for 'stackleak_track_stack' [-Werror=missing-prototypes]

Add declarations to the stackleak header to shut up the warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20231108125843.3806765-7-arnd@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>

authored by

Arnd Bergmann and committed by
Kees Cook
65120498 9cca73d7

+6
+6
include/linux/stackleak.h
··· 14 14 15 15 #ifdef CONFIG_GCC_PLUGIN_STACKLEAK 16 16 #include <asm/stacktrace.h> 17 + #include <linux/linkage.h> 17 18 18 19 /* 19 20 * The lowest address on tsk's stack which we can plausibly erase. ··· 76 75 t->prev_lowest_stack = t->lowest_stack; 77 76 # endif 78 77 } 78 + 79 + asmlinkage void noinstr stackleak_erase(void); 80 + asmlinkage void noinstr stackleak_erase_on_task_stack(void); 81 + asmlinkage void noinstr stackleak_erase_off_task_stack(void); 82 + void __no_caller_saved_registers noinstr stackleak_track_stack(void); 79 83 80 84 #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */ 81 85 static inline void stackleak_task_init(struct task_struct *t) { }