Re: [PATCH] powerpc: Check end of stack canary at oops time
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2010-08-30 00:18:28
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2010-08-30 00:18:28
On Wed, 2010-08-25 at 09:15 +1000, Anton Blanchard wrote:
/* Are we prepared to handle this fault? */ if ((entry = search_exception_tables(regs->nip)) != NULL) {@@ -413,5 +415,9 @@ void bad_page_fault(struct pt_regs *regs printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n", regs->nip); + stackend = end_of_stack(current); + if (current != &init_task && *stackend != STACK_END_MAGIC) + printk(KERN_ALERT "Thread overran stack, or stack corrupted\n"); + die("Kernel access of bad area", regs, sig); }
Is it worth making it a __get_user or similar just in case ? I suppose if the stack is really busted we wouldn't even have reached that code ... Cheers, Ben.