aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jarno <aurel32@debian.org>2014-08-10 12:39:26 +0000
committerAurelien Jarno <aurel32@debian.org>2014-08-10 12:39:26 +0000
commitf3f70bfebc3fbe8ccccc519cb940ae8bf48f0e9b (patch)
tree2f8605837890774eb3b5bbc62cc8804835f374f0
parent64dc915fb69b4f33a3b3a71f4ae0de0de827f9aa (diff)
downloadkernel_replicant_linux-f3f70bfebc3fbe8ccccc519cb940ae8bf48f0e9b.tar.gz
kernel_replicant_linux-f3f70bfebc3fbe8ccccc519cb940ae8bf48f0e9b.tar.bz2
kernel_replicant_linux-f3f70bfebc3fbe8ccccc519cb940ae8bf48f0e9b.zip
* [mips*] Fix FP emulation for unaligned accesses.
svn path=/dists/sid/linux/; revision=21723
-rw-r--r--debian/changelog7
-rw-r--r--debian/patches/bugfix/mips/MIPS-Remove-BUG_ON-is_fpu_owner-in-do_ade.patch63
-rw-r--r--debian/patches/series1
3 files changed, 71 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 40a5d6fcbd58..d74a933773b8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+linux (3.14.15-3) UNRELEASED; urgency=medium
+
+ [ Aurelien Jarno ]
+ * [mips*] Fix FP emulation for unaligned accesses.
+
+ -- Aurelien Jarno <aurel32@debian.org> Thu, 24 Jul 2014 21:05:08 +0200
+
linux (3.14.15-2) unstable; urgency=medium
[ Aurelien Jarno ]
diff --git a/debian/patches/bugfix/mips/MIPS-Remove-BUG_ON-is_fpu_owner-in-do_ade.patch b/debian/patches/bugfix/mips/MIPS-Remove-BUG_ON-is_fpu_owner-in-do_ade.patch
new file mode 100644
index 000000000000..fbb0a3e0b555
--- /dev/null
+++ b/debian/patches/bugfix/mips/MIPS-Remove-BUG_ON-is_fpu_owner-in-do_ade.patch
@@ -0,0 +1,63 @@
+From: Huacai Chen <chenhc@lemote.com>
+Date: Wed, 16 Jul 2014 09:19:16 +0800
+Subject: MIPS: Remove BUG_ON(!is_fpu_owner()) in do_ade()
+Origin: https://git.kernel.org/linus/2e5767a27337812f6850b3fa362419e2f085e5c3
+
+In do_ade(), is_fpu_owner() isn't preempt-safe. For example, when an
+unaligned ldc1 is executed, do_cpu() is called and then FPU will be
+enabled (and TIF_USEDFPU will be set for the current process). Then,
+do_ade() is called because the access is unaligned. If the current
+process is preempted at this time, TIF_USEDFPU will be cleard. So when
+the process is scheduled again, BUG_ON(!is_fpu_owner()) is triggered.
+
+This small program can trigger this BUG in a preemptible kernel:
+
+int main (int argc, char *argv[])
+{
+ double u64[2];
+
+ while (1) {
+ asm volatile (
+ ".set push \n\t"
+ ".set noreorder \n\t"
+ "ldc1 $f3, 4(%0) \n\t"
+ ".set pop \n\t"
+ ::"r"(u64):
+ );
+ }
+
+ return 0;
+}
+
+V2: Remove the BUG_ON() unconditionally due to Paul's suggestion.
+
+Signed-off-by: Huacai Chen <chenhc@lemote.com>
+Signed-off-by: Jie Chen <chenj@lemote.com>
+Signed-off-by: Rui Wang <wangr@lemote.com>
+Cc: <stable@vger.kernel.org>
+Cc: John Crispin <john@phrozen.org>
+Cc: Steven J. Hill <Steven.Hill@imgtec.com>
+Cc: linux-mips@linux-mips.org
+Cc: Fuxin Zhang <zhangfx@lemote.com>
+Cc: Zhangjin Wu <wuzhangjin@gmail.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/kernel/unaligned.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
+index 2b35172..e11906d 100644
+--- a/arch/mips/kernel/unaligned.c
++++ b/arch/mips/kernel/unaligned.c
+@@ -690,7 +690,6 @@ static void emulate_load_store_insn(struct pt_regs *regs,
+ case sdc1_op:
+ die_if_kernel("Unaligned FP access in kernel code", regs);
+ BUG_ON(!used_math());
+- BUG_ON(!is_fpu_owner());
+
+ lose_fpu(1); /* Save FPU state for the emulator. */
+ res = fpu_emulator_cop1Handler(regs, &current->thread.fpu, 1,
+--
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index a1541094a6a7..9f7d058abd0d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -69,6 +69,7 @@ bugfix/mips/MIPS-OCTEON-make-get_system_type-thread-safe.patch
bugfix/mips/MIPS-O32-32-bit-Fix-bug-which-can-cause-incorrect-sy.patch
bugfix/mips/MIPS-tlbex-fix-a-missing-statement-for-HUGETLB.patch
bugfix/mips/MIPS-prevent-user-from-setting-FCSR-cause-bits.patch
+bugfix/mips/MIPS-Remove-BUG_ON-is_fpu_owner-in-do_ade.patch
# Miscellaneous bug fixes
bugfix/all/misc-bmp085-Enable-building-as-a-module.patch