[PATCH] powerpc: Check end of stack canary at oops time

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Aug 30 10:18:19 EST 2010


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.



More information about the Linuxppc-dev mailing list