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)?
How to turn off stack protector in linux kernel easily?
security;linux kernel;compiling;configuration;kernel modules
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.txtYou 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. 