Patch "s390/checksum: always use cksm instruction" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    s390/checksum: always use cksm instruction

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-checksum-always-use-cksm-instruction.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b11289c7df2991d09e6d18c70bc165ce2dc0d4a4
Author: Heiko Carstens <hca@xxxxxxxxxxxxx>
Date:   Thu Mar 30 12:55:46 2023 +0200

    s390/checksum: always use cksm instruction
    
    [ Upstream commit e42ac7789df64120d7d3d57433dfc9f37ec0cb99 ]
    
    Commit dfe843dce775 ("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@xxxxxxxxxxxxx>
    Fixes: dfe843dce775 ("s390/checksum: support GENERIC_CSUM, enable it for KASAN")
    Tested-by: Alexander Egorenkov <egorenar@xxxxxxxxxxxxx>
    Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
    Signed-off-by: Vasily Gorbik <gor@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 7fd08755a1f9e..854a6581d2f90 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -26,10 +26,6 @@ config GENERIC_BUG
 config GENERIC_BUG_RELATIVE_POINTERS
 	def_bool y
 
-config GENERIC_CSUM
-	bool
-	default y if KASAN
-
 config GENERIC_LOCKBREAK
 	def_bool y if PREEMPTION
 
diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h
index d977a3a2f6190..1b6b992cf18ed 100644
--- a/arch/s390/include/asm/checksum.h
+++ b/arch/s390/include/asm/checksum.h
@@ -12,12 +12,7 @@
 #ifndef _S390_CHECKSUM_H
 #define _S390_CHECKSUM_H
 
-#ifdef CONFIG_GENERIC_CSUM
-
-#include <asm-generic/checksum.h>
-
-#else /* CONFIG_GENERIC_CSUM */
-
+#include <linux/kasan-checks.h>
 #include <linux/uaccess.h>
 #include <linux/in6.h>
 
@@ -40,6 +35,7 @@ static inline __wsum csum_partial(const void *buff, int len, __wsum sum)
 		.odd = (unsigned long) len,
 	};
 
+	kasan_check_read(buff, len);
 	asm volatile(
 		"0:	cksm	%[sum],%[rp]\n"
 		"	jo	0b\n"
@@ -135,5 +131,4 @@ static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
 	return csum_fold((__force __wsum)(sum >> 32));
 }
 
-#endif /* CONFIG_GENERIC_CSUM */
 #endif /* _S390_CHECKSUM_H */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux