diff options
author | Sven Schnelle <svens@linux.ibm.com> | 2020-01-22 13:38:22 +0100 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2020-03-10 15:16:25 +0100 |
commit | 0b38b5e1d0e2f361e418e05c179db05bb688bbd6 (patch) | |
tree | e1694c41af0832e7dd737cd6f4ebea668375def9 /arch/s390/kernel/asm-offsets.c | |
parent | d2abfbe4652d2b49d30fe77548cf663e63d2d469 (diff) | |
download | lwn-0b38b5e1d0e2f361e418e05c179db05bb688bbd6.tar.gz lwn-0b38b5e1d0e2f361e418e05c179db05bb688bbd6.zip |
s390: prevent leaking kernel address in BEAR
When userspace executes a syscall or gets interrupted,
BEAR contains a kernel address when returning to userspace.
This make it pretty easy to figure out where the kernel is
mapped even with KASLR enabled. To fix this, add lpswe to
lowcore and always execute it there, so userspace sees only
the lowcore address of lpswe. For this we have to extend
both critical_cleanup and the SWITCH_ASYNC macro to also check
for lpswe addresses in lowcore.
Fixes: b2d24b97b2a9 ("s390/kernel: add support for kernel address space layout randomization (KASLR)")
Cc: <stable@vger.kernel.org> # v5.2+
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/asm-offsets.c')
-rw-r--r-- | arch/s390/kernel/asm-offsets.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index ce33406cfe83..e80f0e6f5972 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c @@ -124,6 +124,8 @@ int main(void) OFFSET(__LC_EXT_DAMAGE_CODE, lowcore, external_damage_code); OFFSET(__LC_MCCK_FAIL_STOR_ADDR, lowcore, failing_storage_address); OFFSET(__LC_LAST_BREAK, lowcore, breaking_event_addr); + OFFSET(__LC_RETURN_LPSWE, lowcore, return_lpswe); + OFFSET(__LC_RETURN_MCCK_LPSWE, lowcore, return_mcck_lpswe); OFFSET(__LC_RST_OLD_PSW, lowcore, restart_old_psw); OFFSET(__LC_EXT_OLD_PSW, lowcore, external_old_psw); OFFSET(__LC_SVC_OLD_PSW, lowcore, svc_old_psw); |