Commit 52c4e575 authored by Linus Torvalds's avatar Linus Torvalds

Make kernel stack dumps handle unaligned kernel stacks more gracefully.

They can happen on x86 as a result of interrupts in BIOS calls.

Noted by Manfred Spraul.
parent 6199faa1
......@@ -104,7 +104,7 @@ void show_trace(struct task_struct *task, unsigned long * stack)
#ifdef CONFIG_KALLSYMS
printk("\n");
#endif
while (((long) stack & (THREAD_SIZE-1)) != 0) {
while (((long) stack & (THREAD_SIZE-4)) != 0) {
addr = *stack++;
if (kernel_text_address(addr)) {
printk(" [<%08lx>] ", addr);
......@@ -138,7 +138,7 @@ void show_stack(struct task_struct *task, unsigned long *esp)
stack = esp;
for(i = 0; i < kstack_depth_to_print; i++) {
if (((long) stack & (THREAD_SIZE-1)) == 0)
if (((long) stack & (THREAD_SIZE-4)) == 0)
break;
if (i && ((i % 8) == 0))
printk("\n ");
......
......@@ -862,7 +862,7 @@ static void store_stackinfo(kmem_cache_t *cachep, unsigned long *addr, unsigned
unsigned long *sptr = &caller;
unsigned long svalue;
while (((long) sptr & (THREAD_SIZE-1)) != 0) {
while (((long) sptr & (THREAD_SIZE-4)) != 0) {
svalue = *sptr++;
if (kernel_text_address(svalue)) {
*addr++=svalue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment