From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 2/7] arm64: consistently use bl for C exception entry
Date: Wed, 26 Jul 2017 19:18:25 +0100 [thread overview]
Message-ID: <1501093110-3844-3-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1501093110-3844-1-git-send-email-mark.rutland@arm.com>
In most cases, our exception entry assembly branches to C handlers with
a BL instruction, but in cases where we do not expect to return, we use
B instead.
While this is correct today, it means that backtraces for fatal
exceptions miss the entry assembly (as the LR is stale at the point we
call C code), while non-fatal exceptions have the entry assembly in the
LR. In subsequent patches, we will need the LR to be set in these cases
in order to backtrace reliably.
This patch updates these sites to use a BL, ensuring consistency, and
preparing for backtrace rework. An ASM_BUG() is added after each of
these new BLs, which both catches unexpected returns, and ensures that
the LR value doesn't point to another function label.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/arm64/kernel/entry.S | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index b738880..660612a 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -351,7 +351,8 @@ END(vectors)
mov x0, sp
mov x1, #\reason
mrs x2, esr_el1
- b bad_mode
+ bl bad_mode
+ ASM_BUG()
.endm
el0_sync_invalid:
@@ -448,14 +449,16 @@ el1_sp_pc:
mrs x0, far_el1
enable_dbg
mov x2, sp
- b do_sp_pc_abort
+ bl do_sp_pc_abort
+ ASM_BUG()
el1_undef:
/*
* Undefined instruction
*/
enable_dbg
mov x0, sp
- b do_undefinstr
+ bl do_undefinstr
+ ASM_BUG()
el1_dbg:
/*
* Debug exception handling
@@ -473,7 +476,8 @@ el1_inv:
mov x0, sp
mov x2, x1
mov x1, #BAD_SYNC
- b bad_mode
+ bl bad_mode
+ ASM_BUG()
ENDPROC(el1_sync)
.align 6
--
1.9.1
next prev parent reply other threads:[~2017-07-26 18:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 18:18 [PATCHv2 0/7] arm64: unwind: fix broken exception stack dump Mark Rutland
2017-07-26 18:18 ` [PATCHv2 1/7] arm64: Add ASM_BUG() Mark Rutland
2017-08-08 15:31 ` Mark Rutland
2017-08-08 15:58 ` Catalin Marinas
2017-08-08 16:10 ` Mark Rutland
2017-08-09 10:07 ` Catalin Marinas
2017-08-09 13:21 ` Mark Rutland
2017-08-09 14:32 ` Catalin Marinas
2017-07-26 18:18 ` Mark Rutland [this message]
2017-07-26 18:18 ` [PATCHv2 3/7] arm64: move non-entry code out of .entry.text Mark Rutland
2017-07-26 21:38 ` Stephen Boyd
2017-07-31 10:21 ` Mark Rutland
2017-07-26 18:18 ` [PATCHv2 4/7] arm64: unwind: avoid percpu indirection for irq stack Mark Rutland
2017-07-26 18:18 ` [PATCHv2 5/7] arm64: unwind: disregard frame.sp when validating frame pointer Mark Rutland
2017-07-26 18:18 ` [PATCHv2 6/7] arm64: unwind: reference pt_regs via embedded stack frame Mark Rutland
2017-07-26 18:18 ` [PATCHv2 7/7] arm64: unwind: remove sp from struct stackframe Mark Rutland
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=1501093110-3844-3-git-send-email-mark.rutland@arm.com \
--to=mark.rutland@arm.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;
as well as URLs for NNTP newsgroup(s).