Linux kernel has a concept of noinstr code, which is used to prevent
all kinds of instrumentation for annotated functions.
In particular, syscall and IRQ entry functions are implemented as
noinstr.
When these functions call KMSAN-instrumented functions, they fail to
properly set up the metadata for function arguments, potentially leading
to false positive reports.
In order to detect transitions from noinstr to instrumented code, we
introduce the -msan-pass-caller-to-runtime flag, which allows KMSAN to
call msan_get_context_state_caller() at the beginning of functions
that take one or more parameters. msan_get_context_state_caller()
accepts the caller address passed to it by the instrumentation code.
That address can be used by the runtime to figure out whether a call
happened from a noinstr function, and wipe the context state, preventing
the error reports.
For backward compatibility with BSD systems that use KMSAN, we keep
-msan-pass-caller-to-runtime=0 a default value.
Can you avoid ClPassCallerToRuntime and always pass the argument? I guess function will just not use it.