From 013ec287e66cd3e16958fbe20b79d3522877f119 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Mon, 2 Jun 2014 09:00:38 +0000 Subject: [PATCH] [mips,mipsel] Fix branch emulation of branch likely instructions. svn path=/dists/sid/linux/; revision=21375 --- debian/changelog | 3 + ...emulation-of-branch-likely-instructi.patch | 65 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 69 insertions(+) create mode 100644 debian/patches/bugfix/mips/MIPS-Fix-branch-emulation-of-branch-likely-instructi.patch diff --git a/debian/changelog b/debian/changelog index d03da4616..b35ed9192 100644 --- a/debian/changelog +++ b/debian/changelog @@ -92,6 +92,9 @@ linux (3.14.5-1) UNRELEASED; urgency=medium * [arm64] Initial kernel configuration and packaging (Closes: #745349). * [armhf] Add virtio-modules udeb. + [ Aurelien Jarno ] + * [mips,mipsel] Fix branch emulation of branch likely instructions. + -- Ben Hutchings Wed, 21 May 2014 21:24:50 +0100 linux (3.14.4-1) unstable; urgency=high diff --git a/debian/patches/bugfix/mips/MIPS-Fix-branch-emulation-of-branch-likely-instructi.patch b/debian/patches/bugfix/mips/MIPS-Fix-branch-emulation-of-branch-likely-instructi.patch new file mode 100644 index 000000000..3471e775b --- /dev/null +++ b/debian/patches/bugfix/mips/MIPS-Fix-branch-emulation-of-branch-likely-instructi.patch @@ -0,0 +1,65 @@ +From: Ralf Baechle +Date: Thu, 22 May 2014 23:19:00 +0200 +Subject: MIPS: Fix branch emulation of branch likely instructions. +Origin: https://git.kernel.org/linus/41ca86e8502952116234fa558f4277092a5aaae9 + +Two issues: + + o For beql_op, beql_op, bne_op, bnel_op, blez_op, blezl_op, bgtz_op and + bgtzl_op the wrong field was being checked for the instruction opcode. + o For blez_op / blezl_op and bgtz_op / bgtzl_op the test was testing + for the wrong opcode. + +This bug got introduced by d8d4e3ae0b5c179c0bfd3f0af5b352d13bea9cfa [MIPS +Kprobes: Refactor branch emulation]. + +Signed-off-by: Ralf Baechle +Acked-by: Leonid Yegoshin +Acked-by: Victor Kamensky +--- + arch/mips/kernel/branch.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c +index 4d78bf4..76122ff 100644 +--- a/arch/mips/kernel/branch.c ++++ b/arch/mips/kernel/branch.c +@@ -317,7 +317,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, + if (regs->regs[insn.i_format.rs] == + regs->regs[insn.i_format.rt]) { + epc = epc + 4 + (insn.i_format.simmediate << 2); +- if (insn.i_format.rt == beql_op) ++ if (insn.i_format.opcode == beql_op) + ret = BRANCH_LIKELY_TAKEN; + } else + epc += 8; +@@ -329,7 +329,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, + if (regs->regs[insn.i_format.rs] != + regs->regs[insn.i_format.rt]) { + epc = epc + 4 + (insn.i_format.simmediate << 2); +- if (insn.i_format.rt == bnel_op) ++ if (insn.i_format.opcode == bnel_op) + ret = BRANCH_LIKELY_TAKEN; + } else + epc += 8; +@@ -341,7 +341,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, + /* rt field assumed to be zero */ + if ((long)regs->regs[insn.i_format.rs] <= 0) { + epc = epc + 4 + (insn.i_format.simmediate << 2); +- if (insn.i_format.rt == bnel_op) ++ if (insn.i_format.opcode == blezl_op) + ret = BRANCH_LIKELY_TAKEN; + } else + epc += 8; +@@ -353,7 +353,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, + /* rt field assumed to be zero */ + if ((long)regs->regs[insn.i_format.rs] > 0) { + epc = epc + 4 + (insn.i_format.simmediate << 2); +- if (insn.i_format.rt == bnel_op) ++ if (insn.i_format.opcode == bgtzl_op) + ret = BRANCH_LIKELY_TAKEN; + } else + epc += 8; +-- +2.0.0.rc0 + diff --git a/debian/patches/series b/debian/patches/series index 36a82377c..abf2e67ce 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -88,3 +88,4 @@ debian/net-revert-lockdep-changes-in-3.14.5.patch debian/sockdiag-avoid-abi-change-in-3.14.5.patch debian/target-avoid-abi-change-in-3.14.5.patch debian/netfilter-avoid-abi-change-in-3.14.5.patch +bugfix/mips/MIPS-Fix-branch-emulation-of-branch-likely-instructi.patch