• Heiko Carstens's avatar
    s390/checksum: always use cksm instruction · e42ac778
    Heiko Carstens authored
    Commit dfe843dc ("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: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
    Fixes: dfe843dc ("s390/checksum: support GENERIC_CSUM, enable it for KASAN")
    Tested-by: default avatarAlexander Egorenkov <egorenar@linux.ibm.com>
    Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    e42ac778
Kconfig 25.3 KB