The default assembly handling mode may introduce false positives in the cases when MSan doesn't understand that the assembly call initializes the memory pointed to by one of its arguments.
We introduce the conservative mode, which initializes every memory location passed into the assembly statement.
Details
- Reviewers
eugenis vitalybuka dvyukov
Diff Detail
Event Timeline
lib/Transforms/Instrumentation/MemorySanitizer.cpp | ||
---|---|---|
2734 | I didn't touch this comment, as it remains more or less valid. |
This approach can not handle arrays - it would unpoison only the first element. It could be confusing for the user, but not really worse than the current state. Please mention this in the comment and/or the flag description.
I think it's OK to enable this feature by default.
lib/Transforms/Instrumentation/MemorySanitizer.cpp | ||
---|---|---|
3080 | Move this above visitInstruction. | |
3110 | Origin is meaningless for unpoisoned memory. All this does is potentially destroy origin info for adjacent memory in case of a less than 4 byte store. |
I think it's OK to enable this feature by default.
I wouldn't haste with that. First, this approach is not strictly better than the existing one, e.g. it may unpoison the memory that wasn't touched in the assembly.
Second, turning this on may break the clients, so we'd better do that in a separate changelist.
lib/Transforms/Instrumentation/MemorySanitizer.cpp | ||
---|---|---|
3110 | Ack. |
FWIW, we couldn't enable this mode in KMSAN by default.
Turned out people are passing all sorts of random pointers into inline assembly in the kernel (sometimes those arguments are unused by the assembly itself), and unpoisoning those just triggers page faults.
Guess it's worth looking into instrumenting the assembly with calls, so that we can check the pointers at runtime.
I didn't touch this comment, as it remains more or less valid.