From eaf6fde90734e52c58c4d2288d4ae97e640c7fa3 Mon Sep 17 00:00:00 2001 From: Miroslav Franc Date: May 12 2023 18:31:00 +0000 Subject: s390/kasan: fix early pgm check handler execution (git-fixes bsc#1211360). --- diff --git a/patches.suse/s390-kasan-fix-early-pgm-check-handler-execution.patch b/patches.suse/s390-kasan-fix-early-pgm-check-handler-execution.patch new file mode 100644 index 0000000..fa90017 --- /dev/null +++ b/patches.suse/s390-kasan-fix-early-pgm-check-handler-execution.patch @@ -0,0 +1,38 @@ +From: Vasily Gorbik +Date: Wed, 17 Jun 2020 15:05:49 +0200 +Subject: s390/kasan: fix early pgm check handler execution +Git-commit: 998f5bbe3dbdab81c1cfb1aef7c3892f5d24f6c7 +Patch-mainline: v5.8-rc3 +References: git-fixes bsc#1211360 + +Currently if early_pgm_check_handler is called it ends up in pgm check +loop. The problem is that early_pgm_check_handler is instrumented by +KASAN but executed without DAT flag enabled which leads to addressing +exception when KASAN checks try to access shadow memory. + +Fix that by executing early handlers with DAT flag on under KASAN as +expected. + +Reported-and-tested-by: Alexander Egorenkov +Reviewed-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Heiko Carstens +Acked-by: Miroslav Franc +--- + arch/s390/kernel/early.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c +index cd241ee66eff..078277231858 100644 +--- a/arch/s390/kernel/early.c ++++ b/arch/s390/kernel/early.c +@@ -170,6 +170,8 @@ static noinline __init void setup_lowcore_early(void) + psw_t psw; + + psw.mask = PSW_MASK_BASE | PSW_DEFAULT_KEY | PSW_MASK_EA | PSW_MASK_BA; ++ if (IS_ENABLED(CONFIG_KASAN)) ++ psw.mask |= PSW_MASK_DAT; + psw.addr = (unsigned long) s390_base_ext_handler; + S390_lowcore.external_new_psw = psw; + psw.addr = (unsigned long) s390_base_pgm_handler; + diff --git a/series.conf b/series.conf index c063830..509733d 100644 --- a/series.conf +++ b/series.conf @@ -57080,6 +57080,7 @@ patches.suse/0010-ALSA-usb-audio-Add-registration-quirk-for-Kingston-H.patch patches.suse/ALSA-usb-audio-add-quirk-for-Samsung-USBC-Headset-AK.patch patches.suse/ALSA-usb-audio-Fix-OOB-access-of-mixer-element-list.patch + patches.suse/s390-kasan-fix-early-pgm-check-handler-execution.patch patches.suse/RDMA-efa-Set-maximum-pkeys-device-attribute.patch patches.suse/RDMA-qedr-Fix-KASAN-use-after-free-in-ucma_event_han.patch patches.suse/RDMA-cma-Protect-bind_list-and-listen_list-while-fin.patch