Once we start instrumenting globals, all addresses including those of string literals
that we pass to the operating system will start being tagged. Since we can't rely
on the operating system to be able to cope with these addresses, we need to untag
them before passing them to the operating system. This change introduces a macro
that does so and uses it everywhere it is needed.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Instead of putting UNTAG everywhere, could we change %clang_hwasan to instead have globals instrumentation disabled, then only use UNTAG in the hwasan_globals tests? WDYT?
The reason why I did it this way was to make the tests as "realistic" as possible. The more we diverge from a "realistic" build the more likely it is that bugs slip through because we aren't testing what we ship.
Understood. I'm not the biggest fan of putting macros all around the codebase - could we define our own ErrorPrintf()/Printf()/strcmp() and explicitly untag there? I think relying on explicit untagging everywhere may be error-prone, and it looks like we can reduce the mental overhead of remembering to explicitly untag.
If you forget to untag, your test will not pass once the global instrumentation change lands. So I'm personally not too concerned about this.
That said, adding the wrappers seems fine to me. I'll do that.
compiler-rt/test/hwasan/TestCases/utils.h | ||
---|---|---|
10 ↗ | (On Diff #213465) | No idea why clang-format isn't obeying <=80 cols here, oh well. |