Cc: stable@xxxxxxxxxxxxxxx # 3.19+ Signed-off-by: Maciej W. Rozycki <macro@xxxxxxxxxx> --- Not a fix by itself, but needed for the next 2 changes. Maciej linux-mips-epc-for-insn-sigill-r6-to-r2r6.diff Index: linux-sfr-test/arch/mips/kernel/branch.c =================================================================== --- linux-sfr-test.orig/arch/mips/kernel/branch.c 2017-06-01 06:33:27.149519000 +0100 +++ linux-sfr-test/arch/mips/kernel/branch.c 2017-06-01 06:33:32.663567000 +0100 @@ -431,7 +431,7 @@ int __compute_return_epc_for_insn(struct /* Fall through */ case jr_op: if (NO_R6EMU && insn.r_format.func == jr_op) - goto sigill_r6; + goto sigill_r2r6; regs->cp0_epc = regs->regs[insn.r_format.rs]; break; } @@ -446,7 +446,7 @@ int __compute_return_epc_for_insn(struct switch (insn.i_format.rt) { case bltzl_op: if (NO_R6EMU) - goto sigill_r6; + goto sigill_r2r6; case bltz_op: if ((long)regs->regs[insn.i_format.rs] < 0) { epc = epc + 4 + (insn.i_format.simmediate << 2); @@ -459,7 +459,7 @@ int __compute_return_epc_for_insn(struct case bgezl_op: if (NO_R6EMU) - goto sigill_r6; + goto sigill_r2r6; case bgez_op: if ((long)regs->regs[insn.i_format.rs] >= 0) { epc = epc + 4 + (insn.i_format.simmediate << 2); @@ -574,7 +570,7 @@ int __compute_return_epc_for_insn(struct */ case beql_op: if (NO_R6EMU) - goto sigill_r6; + goto sigill_r2r6; case beq_op: if (regs->regs[insn.i_format.rs] == regs->regs[insn.i_format.rt]) { @@ -588,7 +584,7 @@ int __compute_return_epc_for_insn(struct case bnel_op: if (NO_R6EMU) - goto sigill_r6; + goto sigill_r2r6; case bne_op: if (regs->regs[insn.i_format.rs] != regs->regs[insn.i_format.rt]) { @@ -602,7 +598,7 @@ int __compute_return_epc_for_insn(struct case blezl_op: /* not really i_format */ if (!insn.i_format.rt && NO_R6EMU) - goto sigill_r6; + goto sigill_r2r6; case blez_op: /* * Compact branches for R6 for the @@ -637,7 +633,7 @@ int __compute_return_epc_for_insn(struct case bgtzl_op: if (!insn.i_format.rt && NO_R6EMU) - goto sigill_r6; + goto sigill_r2r6; case bgtz_op: /* * Compact branches for R6 for the @@ -834,7 +830,7 @@ int __compute_return_epc_for_insn(struct current->comm); force_sig(SIGILL, current); return -EFAULT; -sigill_r6: +sigill_r2r6: pr_info("%s: R2 branch but r2-to-r6 emulator is not preset - sending SIGILL.\n", current->comm); force_sig(SIGILL, current);