Skip to content

Commit f28e32a

Browse files
Maciej W. Rozyckigregkh
authored andcommitted
MIPS: Send SIGILL for linked branches in `__compute_return_epc_for_insn'
commit fef40be6da856afead4177aaa9d869a66fb3381f upstream. Fix commit 319824e ("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: 319824e ("MIPS: kernel: branch: Do not emulate the branch likelies on MIPS R6") Signed-off-by: Maciej 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: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d2220e7 commit f28e32a

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

arch/mips/kernel/branch.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
473473
case bltzal_op:
474474
case bltzall_op:
475475
if (NO_R6EMU && (insn.i_format.rs ||
476-
insn.i_format.rt == bltzall_op)) {
477-
ret = -SIGILL;
478-
break;
479-
}
476+
insn.i_format.rt == bltzall_op))
477+
goto sigill_r2r6;
480478
regs->regs[31] = epc + 8;
481479
/*
482480
* OK we are here either because we hit a NAL
@@ -507,10 +505,8 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
507505
case bgezal_op:
508506
case bgezall_op:
509507
if (NO_R6EMU && (insn.i_format.rs ||
510-
insn.i_format.rt == bgezall_op)) {
511-
ret = -SIGILL;
512-
break;
513-
}
508+
insn.i_format.rt == bgezall_op))
509+
goto sigill_r2r6;
514510
regs->regs[31] = epc + 8;
515511
/*
516512
* OK we are here either because we hit a BAL

0 commit comments

Comments
 (0)