[PATCH] D126385: [msan] Implement -msan-pass-caller-to-runtime.
Alexander Potapenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 30 07:57:47 PDT 2022
glider added a comment.
Herald added a subscriber: Enna1.
In D126385#3542914 <https://reviews.llvm.org/D126385#3542914>, @vitalybuka wrote:
> Do you have estimate of how often this happend? How many different instrumented functions which can be called from uninstrumented code?
There are ~200 noinstr annotations in the Linux kernel. Some are used in macros (e.g. there are several dozens of interrupt descriptor table entries that are implemented as noinstr functions).
It's hard to tell how many instrumented functions end up being called with consequences, but certainly annotating them manually is not an option.
We could probably optimize by not passing __builtin_return_address() to __msan_get_context_state() if the instrumented function doesn't take any arguments. Not sure it is worth the hassle (we'll need a separate version of __msan_get_context_state())
================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:1274
+ Intrinsic::getDeclaration(F.getParent(), Intrinsic::returnaddress),
+ IRB.getInt32(0));
+ ContextState = IRB.CreateCall(MS.MsanGetContextStateFn, RetAddr);
----------------
vitalybuka wrote:
> Can you avoid ClPassCallerToRuntime and always pass the argument? I guess function will just not use it.
>
This would cost us a register spill, sounds like a regression for *BSD systems that don't need the argument.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126385/new/
https://reviews.llvm.org/D126385
More information about the llvm-commits
mailing list