]>
Commit | Line | Data |
---|---|---|
a8cbbf0d GKH |
1 | From 60f1bf29c0b2519989927cae640cd1f50f59dc7f Mon Sep 17 00:00:00 2001 |
2 | From: David Hildenbrand <david@redhat.com> | |
3 | Date: Fri, 11 Jan 2019 15:18:22 +0100 | |
4 | Subject: s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU | |
5 | ||
6 | From: David Hildenbrand <david@redhat.com> | |
7 | ||
8 | commit 60f1bf29c0b2519989927cae640cd1f50f59dc7f upstream. | |
9 | ||
10 | When calling smp_call_ipl_cpu() from the IPL CPU, we will try to read | |
11 | from pcpu_devices->lowcore. However, due to prefixing, that will result | |
12 | in reading from absolute address 0 on that CPU. We have to go via the | |
13 | actual lowcore instead. | |
14 | ||
15 | This means that right now, we will read lc->nodat_stack == 0 and | |
16 | therfore work on a very wrong stack. | |
17 | ||
18 | This BUG essentially broke rebooting under QEMU TCG (which will report | |
19 | a low address protection exception). And checking under KVM, it is | |
20 | also broken under KVM. With 1 VCPU it can be easily triggered. | |
21 | ||
22 | :/# echo 1 > /proc/sys/kernel/sysrq | |
23 | :/# echo b > /proc/sysrq-trigger | |
24 | [ 28.476745] sysrq: SysRq : Resetting | |
25 | [ 28.476793] Kernel stack overflow. | |
26 | [ 28.476817] CPU: 0 PID: 424 Comm: sh Not tainted 5.0.0-rc1+ #13 | |
27 | [ 28.476820] Hardware name: IBM 2964 NE1 716 (KVM/Linux) | |
28 | [ 28.476826] Krnl PSW : 0400c00180000000 0000000000115c0c (pcpu_delegate+0x12c/0x140) | |
29 | [ 28.476861] R:0 T:1 IO:0 EX:0 Key:0 M:0 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3 | |
30 | [ 28.476863] Krnl GPRS: ffffffffffffffff 0000000000000000 000000000010dff8 0000000000000000 | |
31 | [ 28.476864] 0000000000000000 0000000000000000 0000000000ab7090 000003e0006efbf0 | |
32 | [ 28.476864] 000000000010dff8 0000000000000000 0000000000000000 0000000000000000 | |
33 | [ 28.476865] 000000007fffc000 0000000000730408 000003e0006efc58 0000000000000000 | |
34 | [ 28.476887] Krnl Code: 0000000000115bfe: 4170f000 la %r7,0(%r15) | |
35 | [ 28.476887] 0000000000115c02: 41f0a000 la %r15,0(%r10) | |
36 | [ 28.476887] #0000000000115c06: e370f0980024 stg %r7,152(%r15) | |
37 | [ 28.476887] >0000000000115c0c: c0e5fffff86e brasl %r14,114ce8 | |
38 | [ 28.476887] 0000000000115c12: 41f07000 la %r15,0(%r7) | |
39 | [ 28.476887] 0000000000115c16: a7f4ffa8 brc 15,115b66 | |
40 | [ 28.476887] 0000000000115c1a: 0707 bcr 0,%r7 | |
41 | [ 28.476887] 0000000000115c1c: 0707 bcr 0,%r7 | |
42 | [ 28.476901] Call Trace: | |
43 | [ 28.476902] Last Breaking-Event-Address: | |
44 | [ 28.476920] [<0000000000a01c4a>] arch_call_rest_init+0x22/0x80 | |
45 | [ 28.476927] Kernel panic - not syncing: Corrupt kernel stack, can't continue. | |
46 | [ 28.476930] CPU: 0 PID: 424 Comm: sh Not tainted 5.0.0-rc1+ #13 | |
47 | [ 28.476932] Hardware name: IBM 2964 NE1 716 (KVM/Linux) | |
48 | [ 28.476932] Call Trace: | |
49 | ||
50 | Fixes: 2f859d0dad81 ("s390/smp: reduce size of struct pcpu") | |
51 | Cc: stable@vger.kernel.org # 4.0+ | |
52 | Reported-by: Cornelia Huck <cohuck@redhat.com> | |
53 | Signed-off-by: David Hildenbrand <david@redhat.com> | |
54 | Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> | |
55 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
56 | ||
57 | --- | |
58 | arch/s390/kernel/smp.c | 8 ++++++-- | |
59 | 1 file changed, 6 insertions(+), 2 deletions(-) | |
60 | ||
61 | --- a/arch/s390/kernel/smp.c | |
62 | +++ b/arch/s390/kernel/smp.c | |
63 | @@ -360,9 +360,13 @@ void smp_call_online_cpu(void (*func)(vo | |
64 | */ | |
65 | void smp_call_ipl_cpu(void (*func)(void *), void *data) | |
66 | { | |
67 | + struct _lowcore *lc = pcpu_devices->lowcore; | |
68 | + | |
69 | + if (pcpu_devices[0].address == stap()) | |
70 | + lc = &S390_lowcore; | |
71 | + | |
72 | pcpu_delegate(&pcpu_devices[0], func, data, | |
73 | - pcpu_devices->lowcore->panic_stack - | |
74 | - PANIC_FRAME_OFFSET + PAGE_SIZE); | |
75 | + lc->panic_stack - PANIC_FRAME_OFFSET + PAGE_SIZE); | |
76 | } | |
77 | ||
78 | int smp_find_processor_id(u16 address) |