-
Notifications
You must be signed in to change notification settings - Fork 191
[cpuid-x86.h] Add MSAN annotations to mark memory as initialized #647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It cannot, really? We already explicitly express what values are written through |
That doesn't appear to suffice. MSAN has to add instrumentation code, and also it doesn't know what the assembly is doing. I think you should be able to reproduce this quite easily with a small toy example that just sets a variable via assembly and returns if form |
Ok, but what I am saying is that it is the wrong place to fix this, since the code is already expressing what MSAN needs to know (actually compilers have always needed it so as to properly integrate inline assembly in the rest of their code).
It does know what it needs to know: |
Aha, I discussed this with the LLVM team, and it looks like MSAN does recognize outputs. It's only the That itself could also be an issue with MSAN, though. |
Not handling indirect output constraints in inline assembly in a known issue in MemorySanitizer: google/sanitizers#192 llvm/llvm-project#77393 should help this |
FYI, the CI breakage was unrelated, it passes now. |
@bgoglin Thanks! I was hoping that'd be the case :-) |
@sthibaul Given that it's unlikely that MSAN will support the |
Yes, but please add the link to llvm/llvm-project#77393 along the call, so we remember why we still put this and know from which llvm version we will be able to drop it. |
@sthibaul That's done. Note, though, that that PR is not going to enable the effect tracking by default, but only in conjunction with a separate flag, so there's still a bit more to do after that PR lands. |
AIUI from llvm/llvm-project#77393 having to add the flag will only be temporary |
To be sure I understand, the hwloc side of the PR is complete, the (temporary) flag doesn't require any change in hwloc itself? |
yes, the flag is only to be used along |
Thank you! |
It is valuable for Clang's MSAN to detect uninitialized memory accesses, but MSAN cannot instrument the explicit assembly, so we have to annotate the effects of the assembly manually.