]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
s390/kaslr: store KASLR offset for early dumps
authorGerald Schaefer <gerald.schaefer@de.ibm.com>
Tue, 19 Nov 2019 11:30:53 +0000 (12:30 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 13:39:22 +0000 (07:39 -0600)
commit576fb2d06d8077e88fa2da8f8da5a77c2cd94178
tree69c7069c438dd89644116c7553437403507cce9e
parent2e838e1d128873b3c2f6efa70f659aefd60dc73c
s390/kaslr: store KASLR offset for early dumps

BugLink: https://bugs.launchpad.net/bugs/1858424
commit a9f2f6865d784477e1c7b59269d3a384abafd9ca upstream.

The KASLR offset is added to vmcoreinfo in arch_crash_save_vmcoreinfo(),
so that it can be found by crash when processing kernel dumps.

However, arch_crash_save_vmcoreinfo() is called during a subsys_initcall,
so if the kernel crashes before that, we have no vmcoreinfo and no KASLR
offset.

Fix this by storing the KASLR offset in the lowcore, where the vmcore_info
pointer will be stored, and where it can be found by crash. In order to
make it distinguishable from a real vmcore_info pointer, mark it as uneven
(KASLR offset itself is aligned to THREAD_SIZE).

When arch_crash_save_vmcoreinfo() stores the real vmcore_info pointer in
the lowcore, it overwrites the KASLR offset. At that point, the KASLR
offset is not yet added to vmcoreinfo, so we also need to move the
mem_assign_absolute() behind the vmcoreinfo_append_str().

Fixes: b2d24b97b2a9 ("s390/kernel: add support for kernel address space layout randomization (KASLR)")
Cc: <stable@vger.kernel.org> # v5.2+
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/s390/boot/startup.c
arch/s390/kernel/machine_kexec.c