0

I wrote a simple module for the Linux Kernel and it has a stack buffer overflow vulnerability. I want to exploit the module, but I have to turn off the stack protector in the kernel first. How could I do this quickly and simply?

Is it required to compile the kernel every time?

Is there any other way to turn off stack protection in a module of the Linux Kernel (without compiling the kernel)?

0
1

Those options work by passing options to the compiler, so the most straightforward way is to recompile the kernel.

However for a reproducible and module-specific way kbuild allows you to set custom CFLAGs on a per-module basis.

https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt

You particularly want to set -fno-stack-protector for the modules you want to exploit.

DKMS additionally allows you to set up automatic rebuild for out of tree drivers against arbitrary kernel versions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.