* Nathan Chancellor <nathan@xxxxxxxxxx> wrote: > 1. kernel/stackleak.c build failure: > > $ make -skj"$(nproc)" ARCH=x86_64 allmodconfig kernel/stackleak.o > kernel/stackleak.c: In function ‘stackleak_erase’: > kernel/stackleak.c:92:13: error: implicit declaration of function ‘on_thread_stack’; did you mean ‘setup_thread_stack’? [-Werror=implicit-function-declaration] So it turns out that my build environment didn't have the stackleak code enabled at all: kepler:~/mingo.tip.git> make ARCH=x86_64 allmodconfig # # configuration written to .config # kepler:~/mingo.tip.git> grep -E 'STACKLEAK|GCC_PLUGIN' .config CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_GCC_PLUGINS=y ... because it failed this condition: menuconfig GCC_PLUGINS ... depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h) ... because there were no plugin headers: kepler:~/mingo.tip.git> gcc -print-file-name=plugin /usr/lib/gcc/x86_64-linux-gnu/10/plugin kepler:~/mingo.tip.git> ls $(gcc -print-file-name=plugin)/include/ ls: cannot access '/usr/lib/gcc/x86_64-linux-gnu/10/plugin/include/': No such file or directory ... because I needed to install the plugin-development packages for gcc-10. After installing those I have stackleak: kepler:~/mingo.tip.git> grep STACKLEAK .config CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_GCC_PLUGIN_STACKLEAK=y CONFIG_STACKLEAK_TRACK_MIN_SIZE=100 CONFIG_STACKLEAK_METRICS=y CONFIG_STACKLEAK_RUNTIME_DISABLE=y and was able to reproduce your build failure. :-) > This is fixed with the following diff although I am unsure if that is as > minimal as it should be. > > diff --git a/kernel/stackleak.c b/kernel/stackleak.c > index ce161a8e8d97..d67c5475183b 100644 > --- a/kernel/stackleak.c > +++ b/kernel/stackleak.c > @@ -10,8 +10,10 @@ > * reveal and blocks some uninitialized stack variable attacks. > */ > > +#include <asm/processor_api.h> > #include <linux/stackleak.h> > #include <linux/kprobes.h> > +#include <linux/align.h> Yeah - I used a simpler & more generic header: <linux/ptrace_api.h> - see the patch below. But your solution is functionally equivalent. This fix will be included in -v2, hopefully released later today. Thanks, Ingo ===============> From: Ingo Molnar <mingo@xxxxxxxxxx> Date: Sat, 8 Jan 2022 11:29:17 +0100 Subject: [PATCH] headers/deps: Add header dependencies to .c files: <linux/ptrace_api.h> Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx> --- kernel/stackleak.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/stackleak.c b/kernel/stackleak.c index ce161a8e8d97..fde49e2f209a 100644 --- a/kernel/stackleak.c +++ b/kernel/stackleak.c @@ -10,6 +10,7 @@ * reveal and blocks some uninitialized stack variable attacks. */ +#include <linux/ptrace_api.h> #include <linux/stackleak.h> #include <linux/kprobes.h>