Re: [PATCH 1/3] x86: mm: disable KMSAN instrumentation for physaddr.c
From: Dave Hansen
Date: Fri Jun 21 2024 - 12:42:00 EST
On 6/21/24 02:48, Alexander Potapenko wrote:
> Enabling CONFIG_DEBUG_VIRTUAL=y together with KMSAN led to infinite
> recursion, because kmsan_get_metadata() ended up calling instrumented
> __pfn_valid() from arch/x86/mm/physaddr.c.
>
> Prevent it by disabling instrumentation of the whole file.
This does seem rather ad-hoc. It's the same basic reason we have
"noinstr": code instrumentation infrastructure uses generally can't be
instrumented itself.
How hard would it be to make sure that kmsan_get_metadata() and friends
don't call any symbols that were compiled with -fsanitize=kernel-memory?
I do also think I'd much rather see __no_kmsan_checks on the functions
than doing whole files. I *guarantee* if code gets moved around that
whoever does it will miss the KMSAN_SANITIZE_physaddr.o in the makefile.