]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.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)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 6 Jan 2020 14:16:48 +0000 (08:16 -0600)
commit5538d44ef4b1b42afd73b9e8bd23e2d8217b2aac
tree5678fd74fb9f2726674a104862d100eb3ce2bdf5
parent6e2ca1e4c0feea7b595731a1c1999d64f7140f6a
s390/kasan: support memcpy_real with TRACE_IRQFLAGS

BugLink: https://bugs.launchpad.net/bugs/1858428
[ Upstream commit 13f9bae579c6bd051e58f326913dd09af1291208 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/s390/mm/maccess.c