parisc: add kernel stack overflow check
authorHelge Deller <deller@gmx.de>
Tue, 7 May 2013 19:28:52 +0000 (19:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jun 2013 17:38:25 +0000 (10:38 -0700)
commit57c9e56523dcb65821d9cbd9382b1cb453ce2ad9
tree16236dd0e7ea4f621fff5acb17ec1fed19480819
parentd92e6a30702e4c2268e6793ccfcb1e2fa5562eb1
parisc: add kernel stack overflow check

commit 9372450cc22d185f708e5cc3557cf991be4b7dc5 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/parisc/Kconfig.debug
arch/parisc/include/asm/thread_info.h
arch/parisc/kernel/irq.c
arch/parisc/kernel/vmlinux.lds.S