Skip to content

Commit

Permalink
s390/checksum: support GENERIC_CSUM, enable it for KASAN
Browse files Browse the repository at this point in the history
This is the s390 variant of commit d911c67 ("x86: kasan: kmsan:
support CONFIG_GENERIC_CSUM on x86, enable it for KASAN/KMSAN"). Even
though most of the s390 specific checksum code is written in C there is
still the csum_partial() inline assembly which could prevent KASAN and
KMSAN from seeing all memory accesses.

Therefore switch to GENERIC_CSUM if KASAN is enabled just like x86.

Reviewed-by: Vasily Gorbik <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Alexander Gordeev <[email protected]>
  • Loading branch information
hcahca authored and Alexander Gordeev committed Dec 2, 2022
1 parent 78c045c commit dfe843d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/s390/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ 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

Expand Down
7 changes: 7 additions & 0 deletions arch/s390/include/asm/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
#ifndef _S390_CHECKSUM_H
#define _S390_CHECKSUM_H

#ifdef CONFIG_GENERIC_CSUM

#include <asm-generic/checksum.h>

#else /* CONFIG_GENERIC_CSUM */

#include <linux/uaccess.h>
#include <linux/in6.h>

Expand Down Expand Up @@ -129,4 +135,5 @@ 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 */

0 comments on commit dfe843d

Please sign in to comment.