linux-stable/arch/s390
Heiko Carstens 920db3ad2f s390/checksum: always use cksm instruction
[ Upstream commit e42ac7789d ]

Commit dfe843dce7 ("s390/checksum: support GENERIC_CSUM, enable it for
KASAN") switched s390 to use the generic checksum functions, so that KASAN
instrumentation also works checksum functions by avoiding architecture
specific inline assemblies.

There is however the problem that the generic csum_partial() function
returns a 32 bit value with a 16 bit folded checksum, while the original
s390 variant does not fold to 16 bit. This in turn causes that the
ipib_checksum in lowcore contains different values depending on kernel
config options.

The ipib_checksum is used by system dumpers to verify if pointers in
lowcore point to valid data. Verification is done by comparing checksum
values. The system dumpers still use 32 bit checksum values which are not
folded, and therefore the checksum verification fails (incorrectly).

Symptom is that reboot after dump does not work anymore when a KASAN
instrumented kernel is dumped.

Fix this by not using the generic checksum implementation. Instead add an
explicit kasan_check_read() so that KASAN knows about the read access from
within the inline assembly.

Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Fixes: dfe843dce7 ("s390/checksum: support GENERIC_CSUM, enable it for KASAN")
Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:11:28 +09:00
..
appldata s390/appldata: remove power management callbacks 2022-12-02 18:25:04 +01:00
boot s390/ipl: add missing intersection check to ipl_report handling 2023-03-22 13:37:59 +01:00
configs s390: update defconfigs 2023-01-11 21:26:40 +01:00
crypto crypto: Kconfig - simplify cipher entries 2022-08-26 18:50:43 +08:00
hypfs s390/hypfs: remove unused info_blk_hdr__pcpus() function 2022-11-23 16:24:07 +01:00
include s390/checksum: always use cksm instruction 2023-05-11 23:11:28 +09:00
kernel s390/ptrace: fix PTRACE_GET_LAST_BREAK error handling 2023-04-26 14:30:00 +02:00
kvm KVM: s390: pv: fix external interruption loop not always detected 2023-04-13 17:02:36 +02:00
lib s390/uaccess: add missing earlyclobber annotations to __clear_user() 2023-04-06 12:12:45 +02:00
mm s390/extmem: return correct segment type in __segment_load() 2023-03-10 09:29:24 +01:00
net s390/bpf: Add expoline to tail calls 2023-03-10 09:28:11 +01:00
pci PCI: s390: Fix use-after-free of PCI resources with per-function hotplug 2023-03-22 13:37:46 +01:00
purgatory s390/purgatory: remove duplicated build rule of kexec-purgatory.o 2022-06-30 14:18:16 +02:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig s390/checksum: always use cksm instruction 2023-05-11 23:11:28 +09:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile s390: reintroduce expoline dependence to scripts 2023-04-06 12:12:45 +02:00