Commit 4b632ba1 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by Greg Kroah-Hartman

MIPS: Send SIGILL for linked branches in `__compute_return_epc_for_insn'

commit fef40be6 upstream.

Fix commit 319824ea ("MIPS: kernel: branch: Do not emulate the
branch likelies on MIPS R6") and also send SIGILL rather than returning
-SIGILL for BLTZAL, BLTZALL, BGEZAL and BGEZALL instruction encodings no
longer supported in R6, except where emulated.  Returning -SIGILL is
never correct as the API defines this function's result upon error to be
-EFAULT and a signal actually issued.

Fixes: 319824ea ("MIPS: kernel: branch: Do not emulate the branch likelies on MIPS R6")
Signed-off-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16398/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 398cba72
...@@ -473,10 +473,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, ...@@ -473,10 +473,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
case bltzal_op: case bltzal_op:
case bltzall_op: case bltzall_op:
if (NO_R6EMU && (insn.i_format.rs || if (NO_R6EMU && (insn.i_format.rs ||
insn.i_format.rt == bltzall_op)) { insn.i_format.rt == bltzall_op))
ret = -SIGILL; goto sigill_r2r6;
break;
}
regs->regs[31] = epc + 8; regs->regs[31] = epc + 8;
/* /*
* OK we are here either because we hit a NAL * OK we are here either because we hit a NAL
...@@ -507,10 +505,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, ...@@ -507,10 +505,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
case bgezal_op: case bgezal_op:
case bgezall_op: case bgezall_op:
if (NO_R6EMU && (insn.i_format.rs || if (NO_R6EMU && (insn.i_format.rs ||
insn.i_format.rt == bgezall_op)) { insn.i_format.rt == bgezall_op))
ret = -SIGILL; goto sigill_r2r6;
break;
}
regs->regs[31] = epc + 8; regs->regs[31] = epc + 8;
/* /*
* OK we are here either because we hit a BAL * OK we are here either because we hit a BAL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment