Jesper Juhl 2e5aa6824d x86-64: Don't use pointer to out-of-scope variable in dump_trace()
In arch/x86/kernel/dumpstack_64.c::dump_trace() we have this code:

...
  		if (!stack) {
  			unsigned long dummy;
  			stack = &dummy;
  			if (task && task != current)
  				stack = (unsigned long *)task->thread.sp;
  		}

  		bp = stack_frame(task, regs);
  		/*
  		 * Print function call entries in all stacks, starting at the
  		 * current stack address. If the stacks consist of nested
  		 * exceptions
  		 */
  		tinfo = task_thread_info(task);

  		for (;;) {
  			char *id;
  			unsigned long *estack_end;
  			estack_end = in_exception_stack(cpu, (unsigned long)stack,
  							&used, &id);
...

You'll notice that we assign to 'stack' the address of the variable
'dummy' which is only in-scope inside the 'if (!stack)'. So when we later
access stack (at the end of the above, and assuming we did not take the
'if (task && task != current)' branch) we'll be using the address of a
variable that is no longer in scope. I believe this patch is the proper
fix, but I freely admit that I'm not 100% certain.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
LKML-Reference: <alpine.LNX.2.00.1101242232590.10252@swampdragon.chaosbits.net>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2011-01-24 13:46:15 -08:00
..
2010-08-27 11:12:29 -07:00
2010-10-26 16:52:08 -07:00
2010-07-21 11:33:27 -07:00
2011-01-12 11:23:16 +02:00
2010-11-12 00:45:41 +01:00
2010-07-21 21:23:51 -07:00
2010-08-27 11:12:29 -07:00
2010-09-22 16:33:03 -04:00
2011-01-07 15:08:53 +01:00
2011-01-13 17:32:39 -08:00
2010-10-27 18:03:10 -07:00
2011-01-07 15:08:53 +01:00
2011-01-13 17:32:40 -08:00
2011-01-07 15:08:53 +01:00
2011-01-13 17:32:41 -08:00
2010-10-18 10:49:34 -04:00