]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.31/powerpc-fix-32-bit-kvm-pr-lockup-and-host-crash-with-macos-guest.patch
Linux 4.14.108
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / powerpc-fix-32-bit-kvm-pr-lockup-and-host-crash-with-macos-guest.patch
1 From fe1ef6bcdb4fca33434256a802a3ed6aacf0bd2f Mon Sep 17 00:00:00 2001
2 From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
3 Date: Fri, 8 Feb 2019 14:33:19 +0000
4 Subject: powerpc: Fix 32-bit KVM-PR lockup and host crash with MacOS guest
5
6 From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
7
8 commit fe1ef6bcdb4fca33434256a802a3ed6aacf0bd2f upstream.
9
10 Commit 8792468da5e1 "powerpc: Add the ability to save FPU without
11 giving it up" unexpectedly removed the MSR_FE0 and MSR_FE1 bits from
12 the bitmask used to update the MSR of the previous thread in
13 __giveup_fpu() causing a KVM-PR MacOS guest to lockup and panic the
14 host kernel.
15
16 Leaving FE0/1 enabled means unrelated processes might receive FPEs
17 when they're not expecting them and crash. In particular if this
18 happens to init the host will then panic.
19
20 eg (transcribed):
21 qemu-system-ppc[837]: unhandled signal 8 at 12cc9ce4 nip 12cc9ce4 lr 12cc9ca4 code 0
22 systemd[1]: unhandled signal 8 at 202f02e0 nip 202f02e0 lr 001003d4 code 0
23 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
24
25 Reinstate these bits to the MSR bitmask to enable MacOS guests to run
26 under 32-bit KVM-PR once again without issue.
27
28 Fixes: 8792468da5e1 ("powerpc: Add the ability to save FPU without giving it up")
29 Cc: stable@vger.kernel.org # v4.6+
30 Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
31 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33
34 ---
35 arch/powerpc/kernel/process.c | 2 +-
36 1 file changed, 1 insertion(+), 1 deletion(-)
37
38 --- a/arch/powerpc/kernel/process.c
39 +++ b/arch/powerpc/kernel/process.c
40 @@ -180,7 +180,7 @@ static void __giveup_fpu(struct task_str
41
42 save_fpu(tsk);
43 msr = tsk->thread.regs->msr;
44 - msr &= ~MSR_FP;
45 + msr &= ~(MSR_FP|MSR_FE0|MSR_FE1);
46 #ifdef CONFIG_VSX
47 if (cpu_has_feature(CPU_FTR_VSX))
48 msr &= ~MSR_VSX;