linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: Correcting format specifier for printin 64 bit addresses
@ 2016-11-30  8:03 Maninder Singh
  2016-11-30 10:50 ` Will Deacon
       [not found] ` <CGME20161130105054epcas2p2d8e6fbfc65564ff74c646e1ca00d3bf5@epcas2p2.samsung.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Maninder Singh @ 2016-11-30  8:03 UTC (permalink / raw)
  To: catalin.marinas, will.deacon, james.morse, mark.rutland, akpm,
	sandeepa.s.prabhu, labbott, shijie.huang
  Cc: linux-arm-kernel, linux-kernel, ajeet.y, pankaj.m,
	Maninder Singh, Vaneet Narang

This patch corrects format specifier for printing 64 bit addresses.

Before Patch
============
[   68.251603] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[   68.251673] pgd = ffffffc013950000
[   68.251782] [00000000] *pgd=0000000093e19003, *pud=0000000093e19003, *pmd=0000000000000000

After patch
===========
[    8.565030] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[    8.565389] pgd = ffffffc013872000
[    8.565553] [0000000000000000] *pgd=0000000093874003, *pud=0000000093874003, *pmd=0000000000000000

and same for user space fault.

Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
---
 arch/arm64/mm/fault.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index a78a5c4..8cb5c93 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -77,7 +77,7 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
 
 	pr_alert("pgd = %p\n", mm->pgd);
 	pgd = pgd_offset(mm, addr);
-	pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));
+	pr_alert("[%016lx] *pgd=%016llx", addr, pgd_val(*pgd));
 
 	do {
 		pud_t *pud;
@@ -177,7 +177,7 @@ static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr,
 	 * No handler, we'll have to terminate things with extreme prejudice.
 	 */
 	bust_spinlocks(1);
-	pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
+	pr_alert("Unable to handle kernel %s at virtual address %016lx\n",
 		 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
 		 "paging request", addr);
 
@@ -198,9 +198,15 @@ static void __do_user_fault(struct task_struct *tsk, unsigned long addr,
 	struct siginfo si;
 
 	if (unhandled_signal(tsk, sig) && show_unhandled_signals_ratelimited()) {
-		pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
-			tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
-			addr, esr);
+		if (compat_user_mode(regs))
+			pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
+				tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
+				addr, esr);
+		else
+			pr_info("%s[%d]: unhandled %s (%d) at 0x%016lx, esr 0x%03x\n",
+				tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
+				addr, esr);
+
 		show_pte(tsk->mm, addr);
 		show_regs(regs);
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] arm64: Correcting format specifier for printin 64 bit addresses
  2016-11-30  8:03 [PATCH 1/2] arm64: Correcting format specifier for printin 64 bit addresses Maninder Singh
@ 2016-11-30 10:50 ` Will Deacon
       [not found] ` <CGME20161130105054epcas2p2d8e6fbfc65564ff74c646e1ca00d3bf5@epcas2p2.samsung.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2016-11-30 10:50 UTC (permalink / raw)
  To: Maninder Singh
  Cc: catalin.marinas, james.morse, mark.rutland, akpm,
	sandeepa.s.prabhu, labbott, shijie.huang, linux-arm-kernel,
	linux-kernel, ajeet.y, pankaj.m, Vaneet Narang

On Wed, Nov 30, 2016 at 01:33:56PM +0530, Maninder Singh wrote:
> This patch corrects format specifier for printing 64 bit addresses.
> 
> Before Patch
> ============
> [   68.251603] Unable to handle kernel NULL pointer dereference at virtual address 00000000
> [   68.251673] pgd = ffffffc013950000
> [   68.251782] [00000000] *pgd=0000000093e19003, *pud=0000000093e19003, *pmd=0000000000000000
> 
> After patch
> ===========
> [    8.565030] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> [    8.565389] pgd = ffffffc013872000
> [    8.565553] [0000000000000000] *pgd=0000000093874003, *pud=0000000093874003, *pmd=0000000000000000
> 
> and same for user space fault.
> 
> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> ---
>  arch/arm64/mm/fault.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)

There are a bunch of these you haven't caught:

arch/arm64/kernel/signal.c:             pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n",
arch/arm64/kernel/signal32.c:           pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n",
arch/arm64/kernel/signal32.c:           pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n",
arch/arm64/kvm/sys_regs.c:      kvm_err("Unsupported guest CP%d access at: %08lx\n",
arch/arm64/kvm/trace.h: TP_printk("guest executed wf%c at: 0x%08lx",
arch/arm64/kvm/trace.h: TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)",
arch/arm64/kvm/trace.h: TP_printk("%s %s reg %d (0x%08llx)", __entry->fn,  __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value)
arch/arm64/mm/fault.c:  pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));
arch/arm64/mm/fault.c:  pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
arch/arm64/mm/fault.c:          pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
arch/arm64/mm/mmu.c:            pr_warn("fix_to_virt(FIX_BTMAP_BEGIN): %08lx\n",
arch/arm64/mm/mmu.c:            pr_warn("fix_to_virt(FIX_BTMAP_END):   %08lx\n",

so it would probably make sense to fix these to be consistent.

Will

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Re: [PATCH 1/2] arm64: Correcting format specifier for printin 64 bit addresses
       [not found] ` <CGME20161130105054epcas2p2d8e6fbfc65564ff74c646e1ca00d3bf5@epcas2p2.samsung.com>
@ 2016-12-05  8:18   ` Maninder Singh
  0 siblings, 0 replies; 3+ messages in thread
From: Maninder Singh @ 2016-12-05  8:18 UTC (permalink / raw)
  To: Will Deacon
  Cc: catalin.marinas, james.morse, mark.rutland, akpm,
	sandeepa.s.prabhu, labbott, shijie.huang, linux-arm-kernel,
	linux-kernel, Ajeet Kumar Yadav, PANKAJ MISHRA, Vaneet Narang

[-- Attachment #1: Type: text/plain, Size: 708 bytes --]

 
Hi Will,

>There are a bunch of these you haven't caught:
>
....
>arch/arm64/mm/mmu.c:            pr_warn("fix_to_virt(FIX_BTMAP_END):   %08lx\n",
>
>so it would probably make sense to fix these to be consistent.
>
>Will

All changes are sent in new patch except kvm changes, because for kvm we don't not much idea.


>arch/arm64/kernel/signal32.c:           pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n",
>arch/arm64/kernel/signal32.c:           pr_info_ratelimited("%s[%d]: bad frame in %s: pc=%08llx sp=%08llx\n",

and signal32 fiel changes are not required, because it meant only for 32 bit.

--------------------
Thanks and Regards,
Maninder Singh




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-09  5:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30  8:03 [PATCH 1/2] arm64: Correcting format specifier for printin 64 bit addresses Maninder Singh
2016-11-30 10:50 ` Will Deacon
     [not found] ` <CGME20161130105054epcas2p2d8e6fbfc65564ff74c646e1ca00d3bf5@epcas2p2.samsung.com>
2016-12-05  8:18   ` Maninder Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).