mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] arm/stacktrace: stop unwinding after an invalid address.
       [not found] <CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcas5p4.samsung.com>
@ 2018-03-21 11:10 ` Maninder Singh
       [not found]   ` <CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcms5p3>
  0 siblings, 1 reply; 2+ messages in thread
From: Maninder Singh @ 2018-03-21 11:10 UTC (permalink / raw)
  To: linux, dustinb
  Cc: linux-arm-kernel, linux-kernel, a.sahrawat, pankaj.m,
	Maninder Singh, Vaneet Narang

This patch stops unwinding backtrace in case address does not
belong to kernel address like below:-

....
__do_fault+0x4c/0xa8
handle_mm_fault+0xb74/0x11c0
do_page_fault+0x29c/0x38c
do_DataAbort+0x40/0xb8
__dabt_usr+0x44/0x60
0xb6748ea4
^^^^^^^^

So this patch discards last junk entry.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
---
v1->v2: https://lkml.org/lkml/2017/10/24/378
(take care of IRQ taken in SVC mode)

 arch/arm/kernel/stacktrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index a56e7c8..1aadffc 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -92,6 +92,9 @@ static int save_trace(struct stackframe *frame, void *d)
 
 	regs = (struct pt_regs *)frame->sp;
 
+	if (!__kernel_text_address(regs->ARM_pc))
+		return 1;
+
 	trace->entries[trace->nr_entries++] = regs->ARM_pc;
 
 	return trace->nr_entries >= trace->max_entries;
-- 
1.9.1

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

* RE: [PATCH v2] arm/stacktrace: stop unwinding after an invalid address.
       [not found]   ` <CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcms5p3>
@ 2018-04-03 12:58     ` Vaneet Narang
  0 siblings, 0 replies; 2+ messages in thread
From: Vaneet Narang @ 2018-04-03 12:58 UTC (permalink / raw)
  To: Maninder Singh, linux, dustinb
  Cc: linux-arm-kernel, linux-kernel, AMIT SAHRAWAT, PANKAJ MISHRA

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

 
Hi Russell,


>__dabt_usr+0x44/0x60
>0xb6748ea4
>^^^^^^^^

>--- a/arch/arm/kernel/stacktrace.c
>+++ b/arch/arm/kernel/stacktrace.c
>@@ -92,6 +92,9 @@ static int save_trace(struct stackframe *frame, void *d)
> 
> 	regs = (struct pt_regs *)frame->sp;
>
>+	if (!__kernel_text_address(regs->ARM_pc))
>+		return 1;
>+
> 	trace->entries[trace->nr_entries++] = regs->ARM_pc;
 
 
Any Inputs or Comments on this patch to avoid storing user space entries 
during unwind.
 
Regards,
Vaneet Narang

[-- Attachment #2: rcptInfo.txt --]
[-- Type: application/octet-stream, Size: 1636 bytes --]


   =================================================================================================================================
      Subject    : [PATCH v2] arm/stacktrace: stop unwinding after an invalid address.
      From       : Maninder Singh Engineer/SRI-Delhi-Platform S/W 1 Team/Samsung Electronics 
      Sent Date  : 2018-03-21 16:41  GMT+5:30
   =================================================================================================================================
                  Name                Type          Job Title                       Dept.                               Company                
   =================================================================================================================================
      linux@armlinux.org.uk          TO
      dustinb@codeaurora.org         TO
      linux-arm-kernel@lists.in...   CC
      linux-kernel@vger.kernel.org   CC
      AMIT SAHRAWAT                  CC         Staff Engineer             SRI-Delhi-Platform S/W 1 Team             Samsung Electronics
      PANKAJ MISHRA                  CC         Principal Professional     SRI-Delhi-Platform S/W 1 Team             Samsung Electronics
      Maninder Singh                 CC         Engineer                   SRI-Delhi-Platform S/W 1 Team             Samsung Electronics 
      Vaneet Narang                  CC         Staff Engineer             SRI-Delhi-Platform S/W 1 Team             Samsung Electronics
   =================================================================================================================================

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

end of thread, other threads:[~2018-04-03 12:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcas5p4.samsung.com>
2018-03-21 11:10 ` [PATCH v2] arm/stacktrace: stop unwinding after an invalid address Maninder Singh
     [not found]   ` <CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcms5p3>
2018-04-03 12:58     ` Vaneet Narang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®