|
Jiri Slaby |
9cb590 |
From: "Maciej W. Rozycki" <macro@imgtec.com>
|
|
Jiri Slaby |
9cb590 |
Date: Fri, 16 Jun 2017 00:12:53 +0100
|
|
Jiri Slaby |
9cb590 |
Subject: [PATCH] MIPS: Send SIGILL for linked branches in
|
|
Jiri Slaby |
9cb590 |
`__compute_return_epc_for_insn'
|
|
Jiri Slaby |
9cb590 |
References: bnc#1060662
|
|
Thomas Zimmermann |
1d81d2 |
Patch-mainline: v4.12.4
|
|
Jiri Slaby |
9cb590 |
Git-commit: fef40be6da856afead4177aaa9d869a66fb3381f
|
|
Jiri Slaby |
9cb590 |
|
|
Jiri Slaby |
9cb590 |
commit fef40be6da856afead4177aaa9d869a66fb3381f upstream.
|
|
Jiri Slaby |
9cb590 |
|
|
Jiri Slaby |
9cb590 |
Fix commit 319824eabc3f ("MIPS: kernel: branch: Do not emulate the
|
|
Jiri Slaby |
9cb590 |
branch likelies on MIPS R6") and also send SIGILL rather than returning
|
|
Jiri Slaby |
9cb590 |
-SIGILL for BLTZAL, BLTZALL, BGEZAL and BGEZALL instruction encodings no
|
|
Jiri Slaby |
9cb590 |
longer supported in R6, except where emulated. Returning -SIGILL is
|
|
Jiri Slaby |
9cb590 |
never correct as the API defines this function's result upon error to be
|
|
Jiri Slaby |
9cb590 |
-EFAULT and a signal actually issued.
|
|
Jiri Slaby |
9cb590 |
|
|
Jiri Slaby |
9cb590 |
Fixes: 319824eabc3f ("MIPS: kernel: branch: Do not emulate the branch likelies on MIPS R6")
|
|
Jiri Slaby |
9cb590 |
Signed-off-by: Maciej W. Rozycki <macro@imgtec.com>
|
|
Jiri Slaby |
9cb590 |
Cc: James Hogan <james.hogan@imgtec.com>
|
|
Jiri Slaby |
9cb590 |
Cc: linux-mips@linux-mips.org
|
|
Jiri Slaby |
9cb590 |
Patchwork: https://patchwork.linux-mips.org/patch/16398/
|
|
Jiri Slaby |
9cb590 |
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
|
|
Jiri Slaby |
9cb590 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
Jiri Slaby |
9cb590 |
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
|
Jiri Slaby |
9cb590 |
---
|
|
Jiri Slaby |
9cb590 |
arch/mips/kernel/branch.c | 12 ++++--------
|
|
Jiri Slaby |
9cb590 |
1 file changed, 4 insertions(+), 8 deletions(-)
|
|
Jiri Slaby |
9cb590 |
|
|
Jiri Slaby |
9cb590 |
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
|
|
Jiri Slaby |
9cb590 |
index df5c32b38408..64c8360e3d62 100644
|
|
Jiri Slaby |
9cb590 |
--- a/arch/mips/kernel/branch.c
|
|
Jiri Slaby |
9cb590 |
+++ b/arch/mips/kernel/branch.c
|
|
Jiri Slaby |
9cb590 |
@@ -473,10 +473,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
|
|
Jiri Slaby |
9cb590 |
case bltzal_op:
|
|
Jiri Slaby |
9cb590 |
case bltzall_op:
|
|
Jiri Slaby |
9cb590 |
if (NO_R6EMU && (insn.i_format.rs ||
|
|
Jiri Slaby |
9cb590 |
- insn.i_format.rt == bltzall_op)) {
|
|
Jiri Slaby |
9cb590 |
- ret = -SIGILL;
|
|
Jiri Slaby |
9cb590 |
- break;
|
|
Jiri Slaby |
9cb590 |
- }
|
|
Jiri Slaby |
9cb590 |
+ insn.i_format.rt == bltzall_op))
|
|
Jiri Slaby |
9cb590 |
+ goto sigill_r2r6;
|
|
Jiri Slaby |
9cb590 |
regs->regs[31] = epc + 8;
|
|
Jiri Slaby |
9cb590 |
/*
|
|
Jiri Slaby |
9cb590 |
* OK we are here either because we hit a NAL
|
|
Jiri Slaby |
9cb590 |
@@ -507,10 +505,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
|
|
Jiri Slaby |
9cb590 |
case bgezal_op:
|
|
Jiri Slaby |
9cb590 |
case bgezall_op:
|
|
Jiri Slaby |
9cb590 |
if (NO_R6EMU && (insn.i_format.rs ||
|
|
Jiri Slaby |
9cb590 |
- insn.i_format.rt == bgezall_op)) {
|
|
Jiri Slaby |
9cb590 |
- ret = -SIGILL;
|
|
Jiri Slaby |
9cb590 |
- break;
|
|
Jiri Slaby |
9cb590 |
- }
|
|
Jiri Slaby |
9cb590 |
+ insn.i_format.rt == bgezall_op))
|
|
Jiri Slaby |
9cb590 |
+ goto sigill_r2r6;
|
|
Jiri Slaby |
9cb590 |
regs->regs[31] = epc + 8;
|
|
Jiri Slaby |
9cb590 |
/*
|
|
Jiri Slaby |
9cb590 |
* OK we are here either because we hit a BAL
|
|
Jiri Slaby |
9cb590 |
--
|
|
Jiri Slaby |
9cb590 |
2.14.2
|
|
Jiri Slaby |
9cb590 |
|