From 03252919b79891063cf99145612360efbdf9500b Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 30 Jan 2008 13:33:18 +0100 Subject: x86: print which shared library/executable faulted in segfault etc. messages v3 They now look like: hal-resmgr[13791]: segfault at 3c rip 2b9c8caec182 rsp 7fff1e825d30 error 4 in libacl.so.1.1.0[2b9c8caea000+6000] This makes it easier to pinpoint bugs to specific libraries. And printing the offset into a mapping also always allows to find the correct fault point in a library even with randomized mappings. Previously there was no way to actually find the correct code address inside the randomized mapping. Relies on earlier patch to shorten the printk formats. They are often now longer than 80 characters, but I think that's worth it. [includes fix from Eric Dumazet to check d_path error value] Signed-off-by: Andi Kleen Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- arch/x86/mm/fault_32.c | 4 +++- arch/x86/mm/fault_64.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'arch/x86/mm') diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index 13d295506a1..276863dc4bd 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c @@ -514,11 +514,13 @@ bad_area_nosemaphore: #ifdef CONFIG_X86_32 "%s%s[%d]: segfault at %lx ip %08lx sp %08lx error %lx", #else - "%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx\n", + "%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx", #endif task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, tsk->comm, task_pid_nr(tsk), address, regs->ip, regs->sp, error_code); + print_vma_addr(" in ", regs->ip); + printk("\n"); } tsk->thread.cr2 = address; /* Kernel addresses are always protection faults */ diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c index b606bdefbb7..9ef0306efe9 100644 --- a/arch/x86/mm/fault_64.c +++ b/arch/x86/mm/fault_64.c @@ -552,11 +552,13 @@ bad_area_nosemaphore: #ifdef CONFIG_X86_32 "%s%s[%d]: segfault at %lx ip %08lx sp %08lx error %lx", #else - "%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx\n", + "%s%s[%d]: segfault at %lx ip %lx sp %lx error %lx", #endif task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, tsk->comm, task_pid_nr(tsk), address, regs->ip, regs->sp, error_code); + print_vma_addr(" in ", regs->ip); + printk("\n"); } tsk->thread.cr2 = address; -- cgit v1.2.3