diff options
author | Robin Getz <rgetz@blackfin.uclinux.org> | 2008-03-25 21:15:58 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-03-25 21:15:58 -0400 |
commit | 9a62ca40fd793742f92565104c6b44319af8c282 (patch) | |
tree | 6f35dc65b76e9d789da6dc6ca72624adbc389f41 | |
parent | 81d9c7f27dd679df6d03df53eba4fd12caafdb47 (diff) |
[Blackfin] arch: fix bug - when we crash, current is not valid
Sometimes when we crash, current is not valid, (has been written
over), so the existing code causes a invalid read during exception
context - which is a unrecoverable double fault. This fixes this.
Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r-- | arch/blackfin/kernel/traps.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index e8e8f735c236..7557d0dce216 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -655,21 +655,30 @@ void dump_bfin_process(struct pt_regs *fp) | |||
655 | else if (context & 0x8000) | 655 | else if (context & 0x8000) |
656 | printk(KERN_NOTICE "Kernel process context\n"); | 656 | printk(KERN_NOTICE "Kernel process context\n"); |
657 | 657 | ||
658 | if (current->pid && current->mm) { | 658 | /* Because we are crashing, and pointers could be bad, we check things |
659 | * pretty closely before we use them | ||
660 | */ | ||
661 | if (!((unsigned long)current & 0x3) && current->pid) { | ||
659 | printk(KERN_NOTICE "CURRENT PROCESS:\n"); | 662 | printk(KERN_NOTICE "CURRENT PROCESS:\n"); |
660 | printk(KERN_NOTICE "COMM=%s PID=%d\n", | 663 | if (current->comm >= (char *)FIXED_CODE_START) |
661 | current->comm, current->pid); | 664 | printk(KERN_NOTICE "COMM=%s PID=%d\n", |
662 | 665 | current->comm, current->pid); | |
663 | printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" | 666 | else |
664 | KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n" | 667 | printk(KERN_NOTICE "COMM= invalid\n"); |
665 | KERN_NOTICE "\n", | 668 | |
666 | (void *)current->mm->start_code, | 669 | if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) |
667 | (void *)current->mm->end_code, | 670 | printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" |
668 | (void *)current->mm->start_data, | 671 | KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n" |
669 | (void *)current->mm->end_data, | 672 | KERN_NOTICE "\n", |
670 | (void *)current->mm->end_data, | 673 | (void *)current->mm->start_code, |
671 | (void *)current->mm->brk, | 674 | (void *)current->mm->end_code, |
672 | (void *)current->mm->start_stack); | 675 | (void *)current->mm->start_data, |
676 | (void *)current->mm->end_data, | ||
677 | (void *)current->mm->end_data, | ||
678 | (void *)current->mm->brk, | ||
679 | (void *)current->mm->start_stack); | ||
680 | else | ||
681 | printk(KERN_NOTICE "invalid mm\n"); | ||
673 | } else | 682 | } else |
674 | printk(KERN_NOTICE "\n" KERN_NOTICE | 683 | printk(KERN_NOTICE "\n" KERN_NOTICE |
675 | "No Valid process in current context\n"); | 684 | "No Valid process in current context\n"); |