Commit d85e7fbc authored by Mark Rutland's avatar Mark Rutland Committed by Treehugger Robot
Browse files

BACKPORT: arm64: mm: kfence: only handle translation faults

Alexander noted that KFENCE only expects to handle faults from invalid page
table entries (i.e. translation faults), but arm64's fault handling logic will
call kfence_handle_page_fault() for other types of faults, including alignment
faults caused by unaligned atomics. This has the unfortunate property of
causing those other faults to be reported as "KFENCE: use-after-free",
which is misleading and hinders debugging.

Fix this by only forwarding unhandled translation faults to the KFENCE
code, similar to what x86 does already.

Alexander has verified that this passes all the tests in the KFENCE test
suite and avoids bogus reports on misaligned atomics.

Bug: 254441685
Link: https://lore.kernel.org/all/20221102081620.1465154-1-zhongbaisong@huawei.com/


Fixes: 840b2398 ("arm64, kfence: enable KFENCE for ARM64")
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
Tested-by: default avatarAlexander Potapenko <glider@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marco Elver <elver@google.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20221114104411.2853040-1-mark.rutland@arm.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
(cherry picked from commit 0bb1fbff)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: I9cc10807aa2f87100875e2de017a868a845c2cee
parent dc0148ee
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment