mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-17 22:41:25 +00:00
9372450cc2
Add the CONFIG_DEBUG_STACKOVERFLOW config option to enable checks to detect kernel stack overflows. Stack overflows can not be detected reliable since we do not want to introduce too much overhead. Instead, during irq processing in do_cpu_irq_mask() we check kernel stack usage of the interrupted kernel process. Kernel threads can be easily detected by checking the value of space register 7 (sr7) which is zero when running inside the kernel. Since THREAD_SIZE is 16k and PAGE_SIZE is 4k, reduce the alignment of the init thread to the lower value (PAGE_SIZE) in the kernel vmlinux.ld.S linker script. Signed-off-by: Helge Deller <deller@gmx.de>
27 lines
850 B
Plaintext
27 lines
850 B
Plaintext
menu "Kernel hacking"
|
|
|
|
source "lib/Kconfig.debug"
|
|
|
|
config DEBUG_RODATA
|
|
bool "Write protect kernel read-only data structures"
|
|
depends on DEBUG_KERNEL
|
|
help
|
|
Mark the kernel read-only data as write-protected in the pagetables,
|
|
in order to catch accidental (and incorrect) writes to such const
|
|
data. This option may have a slight performance impact because a
|
|
portion of the kernel code won't be covered by a TLB anymore.
|
|
If in doubt, say "N".
|
|
|
|
endmenu
|
|
|
|
config DEBUG_STACKOVERFLOW
|
|
bool "Check for stack overflows"
|
|
default y
|
|
depends on DEBUG_KERNEL
|
|
---help---
|
|
Say Y here if you want to check the overflows of kernel, IRQ
|
|
and exception stacks. This option will cause messages of the
|
|
stacks in detail when free stack space drops below a certain
|
|
limit.
|
|
If in doubt, say "N".
|