public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: maninder1.s@samsung.com (Maninder Singh)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm/stacktrace: stop unwinding after an invalid address.
Date: Wed, 21 Mar 2018 16:40:45 +0530	[thread overview]
Message-ID: <1521630645-46715-1-git-send-email-maninder1.s@samsung.com> (raw)
In-Reply-To: CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcas5p4.samsung.com

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

       reply	other threads:[~2018-03-21 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180321111139epcas5p4d5b75f4e1b572ae4e55aef737cd6d8e9@epcas5p4.samsung.com>
2018-03-21 11:10 ` Maninder Singh [this message]
2018-04-03 12:58   ` [PATCH v2] arm/stacktrace: stop unwinding after an invalid address Vaneet Narang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1521630645-46715-1-git-send-email-maninder1.s@samsung.com \
    --to=maninder1.s@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox