• Vasily Gorbik's avatar
    s390/kasan: support memcpy_real with TRACE_IRQFLAGS · 13f9bae5
    Vasily Gorbik authored
    Currently if the kernel is built with CONFIG_TRACE_IRQFLAGS and KASAN
    and used as crash kernel it crashes itself due to
    trace_hardirqs_off/trace_hardirqs_on being called with DAT off. This
    happens because trace_hardirqs_off/trace_hardirqs_on are instrumented and
    kasan code tries to perform access to shadow memory to validate memory
    accesses. Kasan shadow memory is populated with vmemmap, so all accesses
    require DAT on.
    
    memcpy_real could be called with DAT on or off (with kasan enabled DAT
    is set even before early code is executed).
    
    Make sure that trace_hardirqs_off/trace_hardirqs_on are called with DAT
    on and only actual __memcpy_real is called with DAT off.
    
    Also annotate __memcpy_real and _memcpy_real with __no_sanitize_address
    to avoid further problems due to switching DAT off.
    Reviewed-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    13f9bae5
maccess.c 5.65 KB