]> asedeno.scripts.mit.edu Git - linux.git/commit
s390/kasan: support memcpy_real with TRACE_IRQFLAGS
authorVasily Gorbik <gor@linux.ibm.com>
Tue, 5 Nov 2019 16:33:20 +0000 (17:33 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 20 Nov 2019 11:58:12 +0000 (12:58 +0100)
commit13f9bae579c6bd051e58f326913dd09af1291208
treeb81d6d735ab09737047bb2884bbef36b2788a613
parent0398d4ab1677f7d8cd43aac2aa29a93dfcf9e2e3
s390/kasan: support memcpy_real with TRACE_IRQFLAGS

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: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/mm/maccess.c