android_kernel_oneplus_msm8998/arch/s390/kernel
David Hildenbrand dda201759e s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU
commit 60f1bf29c0b2519989927cae640cd1f50f59dc7f upstream.

When calling smp_call_ipl_cpu() from the IPL CPU, we will try to read
from pcpu_devices->lowcore. However, due to prefixing, that will result
in reading from absolute address 0 on that CPU. We have to go via the
actual lowcore instead.

This means that right now, we will read lc->nodat_stack == 0 and
therfore work on a very wrong stack.

This BUG essentially broke rebooting under QEMU TCG (which will report
a low address protection exception). And checking under KVM, it is
also broken under KVM. With 1 VCPU it can be easily triggered.

:/# echo 1 > /proc/sys/kernel/sysrq
:/# echo b > /proc/sysrq-trigger
[   28.476745] sysrq: SysRq : Resetting
[   28.476793] Kernel stack overflow.
[   28.476817] CPU: 0 PID: 424 Comm: sh Not tainted 5.0.0-rc1+ #13
[   28.476820] Hardware name: IBM 2964 NE1 716 (KVM/Linux)
[   28.476826] Krnl PSW : 0400c00180000000 0000000000115c0c (pcpu_delegate+0x12c/0x140)
[   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
[   28.476863] Krnl GPRS: ffffffffffffffff 0000000000000000 000000000010dff8 0000000000000000
[   28.476864]            0000000000000000 0000000000000000 0000000000ab7090 000003e0006efbf0
[   28.476864]            000000000010dff8 0000000000000000 0000000000000000 0000000000000000
[   28.476865]            000000007fffc000 0000000000730408 000003e0006efc58 0000000000000000
[   28.476887] Krnl Code: 0000000000115bfe: 4170f000            la      %r7,0(%r15)
[   28.476887]            0000000000115c02: 41f0a000            la      %r15,0(%r10)
[   28.476887]           #0000000000115c06: e370f0980024        stg     %r7,152(%r15)
[   28.476887]           >0000000000115c0c: c0e5fffff86e        brasl   %r14,114ce8
[   28.476887]            0000000000115c12: 41f07000            la      %r15,0(%r7)
[   28.476887]            0000000000115c16: a7f4ffa8            brc     15,115b66
[   28.476887]            0000000000115c1a: 0707                bcr     0,%r7
[   28.476887]            0000000000115c1c: 0707                bcr     0,%r7
[   28.476901] Call Trace:
[   28.476902] Last Breaking-Event-Address:
[   28.476920]  [<0000000000a01c4a>] arch_call_rest_init+0x22/0x80
[   28.476927] Kernel panic - not syncing: Corrupt kernel stack, can't continue.
[   28.476930] CPU: 0 PID: 424 Comm: sh Not tainted 5.0.0-rc1+ #13
[   28.476932] Hardware name: IBM 2964 NE1 716 (KVM/Linux)
[   28.476932] Call Trace:

Fixes: 2f859d0dad ("s390/smp: reduce size of struct pcpu")
Cc: stable@vger.kernel.org # 4.0+
Reported-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-06 19:43:05 +01:00
..
vdso32 s390/vdso: add missing FORCE to build targets 2018-11-27 16:08:00 +01:00
vdso64 s390/vdso: add missing FORCE to build targets 2018-11-27 16:08:00 +01:00
.gitignore
alternative.c s390: add automatic detection of the spectre defense 2018-04-29 07:50:04 +02:00
asm-offsets.c s390/ftrace: use expoline for indirect branches 2018-05-30 07:49:17 +02:00
audit.c
audit.h
base.S s390/kernel: use expoline for indirect branches 2018-05-26 08:48:59 +02:00
cache.c
compat_audit.c
compat_linux.c s390: fix handling of -1 in set{,fs}[gu]id16 syscalls 2018-02-22 15:44:58 +01:00
compat_linux.h
compat_ptrace.h
compat_signal.c s390/compat: correct restore of high gprs on signal return 2016-03-03 15:07:12 -08:00
compat_wrapper.c
cpcmd.c
crash_dump.c s390/kdump: Add final note 2017-05-25 14:30:09 +02:00
debug.c
diag.c
dis.c s390/disassembler: increase show_code buffer size 2017-11-30 08:37:18 +00:00
dumpstack.c
early.c s390/early: improve machine detection 2019-02-06 19:43:03 +01:00
ebcdic.c
entry.h
entry.S s390: Correct register corruption in critical section cleanup 2018-07-11 16:03:48 +02:00
ftrace.c
head.S
head64.S s390/cpumf: Fix lpp detection 2016-04-12 09:08:31 -07:00
head_kdump.S
idle.c
ipl.c s390: add options to change branch prediction behaviour for the kernel 2018-04-29 07:50:03 +02:00
irq.c s390: remove indirect branch from do_softirq_own_stack 2018-05-26 08:48:56 +02:00
jump_label.c
kprobes.c
lgr.c
machine_kexec.c
Makefile s390: move spectre sysfs attribute code 2018-05-26 08:48:59 +02:00
mcount.S s390/ftrace: use expoline for indirect branches 2018-05-30 07:49:17 +02:00
module.c s390: correct module section names for expoline code revert 2018-04-29 07:50:04 +02:00
nmi.c
nospec-branch.c s390: extend expoline to BC instructions 2018-05-26 08:48:59 +02:00
nospec-sysfs.c s390: move spectre sysfs attribute code 2018-05-26 08:48:59 +02:00
os_info.c
perf_cpum_cf.c s390/cpum_cf: Reject request for sampling in event initialization 2018-12-17 21:55:09 +01:00
perf_cpum_cf_events.c
perf_cpum_sf.c s390/cpum_sf: ensure sample frequency of perf event attributes is non-zero 2018-05-26 08:48:55 +02:00
perf_event.c
pgm_check.S
process.c s390/runtime instrumentation: simplify task exit handling 2017-12-09 18:42:38 +01:00
processor.c s390: run user space and KVM guests with modified branch prediction 2018-04-29 07:50:03 +02:00
ptrace.c s390/ptrace: Preserve previous registers for short regset write 2017-02-01 08:30:52 +01:00
reipl.S s390/kernel: use expoline for indirect branches 2018-05-26 08:48:59 +02:00
relocate_kernel.S
runtime_instr.c s390/runtime instrumentation: simplify task exit handling 2017-12-09 18:42:38 +01:00
s390_ksyms.c
sclp.c
setup.c s390/early: improve machine detection 2019-02-06 19:43:03 +01:00
signal.c
smp.c s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU 2019-02-06 19:43:05 +01:00
stacktrace.c
suspend.c
swsusp.S s390/kernel: use expoline for indirect branches 2018-05-26 08:48:59 +02:00
sys_s390.c
syscalls.S s390: fix compat system call table 2017-12-16 10:33:49 +01:00
sysinfo.c
time.c
topology.c
trace.c
traps.c
uprobes.c s390/uprobes: implement arch_uretprobe_is_alive() 2018-04-29 07:50:07 +02:00
vdso.c
vmlinux.lds.S s390: introduce execute-trampolines for branches 2018-04-29 07:50:03 +02:00
vtime.c