Re: [PATCH V2] use canary at end of stack to indicate overruns at oops time

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Harvey Harrison
Date: Tuesday, April 22, 2008 - 3:14 pm

On Tue, 2008-04-22 at 16:38 -0500, Eric Sandeen wrote:


Maybe remove the #ifdef CONFIG_DEBUG_STACK_USAGE block and move it into
stack_not_used...call it debug_stack_not_used.


static inline unsigned long debug_stack_not_used(struct task_struct *p)
{
#ifdef CONFIG_DEBUG_STACK_USAGE
	unsigned long *n = end_of_stack(p);

	do { 	/* Skip over canary */
		n++;
	} while (!*n);

	return (unsigned long)n - (unsigned long)end_of_stack(p);
#else
	return $(large_value)....maybe or just some known value.
#endif
}

Also, do you expect this to ever be used outside of sched.c?  Maybe just
leave it as a static function there rather than an inline in the header.

Harvey

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix max-stack calculators to skip canary, Eric Sandeen, (Tue Apr 22, 10:18 am)
Re: [PATCH] Fix max-stack calculators to skip canary, Joe Perches, (Tue Apr 22, 10:33 am)
Re: [PATCH] Fix max-stack calculators to skip canary, Eric Sandeen, (Tue Apr 22, 11:09 am)
Re: [PATCH V2] use canary at end of stack to indicate over ..., Harvey Harrison, (Tue Apr 22, 3:14 pm)
Re: [PATCH] Fix max-stack calculators to skip canary, Ingo Molnar, (Mon Apr 28, 10:28 am)