Such untag operations are redundant, as the stack unwind runtime has to clear
the deallocated portion of the stack anyway.
Details
- Reviewers
eugenis vitalybuka ostannard
Diff Detail
Event Timeline
@pcc We actually went back and forth on this with HWASan, and ended up wrapping personality functions with a small tag cleanup routine:
https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp#L1435
As I understand, this line assumes that "resume" exits clean tags for their frame:
https://github.com/llvm-mirror/compiler-rt/blob/master/lib/hwasan/hwasan_exceptions.cpp#L51
This does not have to be same for MTE, but it has an advantage that frames without tagging do not incur the overhead of untagging when an exception flies by.
On the other hand, exceptions are not expected to be exceptionally fast, and untagging in the unwinder has the advantage of simplicity and smaller code size.
In the end, this is a platform ABI issue and should be documented somewhere - SysV ABI supplement maybe? Or here for Android: https://developer.android.com/ndk/guides/abis.
Indeed, that patch is a bit premature. I've kicked up a discussion about supplementing the (EH)ABI, and this patch need to wait for the outcome.