[PATCH] D149580: [hwasan] support hwasan-match-all-tag flag for callback memory access instrumentation
Mingjie Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 1 04:41:24 PDT 2023
Enna1 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Enna1 added a comment.
Enna1 added reviewers: vitalybuka, eugenis, pcc.
Enna1 added a subscriber: MTC.
Enna1 published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
What do you think about the two approaches. If the first approach is prefered, I'm happy to update this patch using the first approach :)
Currently, hwasan-match-all-tag flag is supported in inline memory access instrumentation and outline memory access instrumentation, but not supported in callback memory access instrumentation.
- For inline memory access instrumentation: a hwasan-match-all-tag check is added following the tag-mismtach check, if tag from pointer is mismatched with tag from shadow memory and tag from pointer is not equal with hwasan-match-all-tag, then a tag-mismatch will be report.
- For outline memory acess instrumentation: MatchAllTag is encoded in AccessInfo, when emit HWASAN memaccess symbols, asm-printer will emit assembly instructions to check if tag from pointer is equal with hwasan-match-all-tag.
- For callback memory access instrumentation: hwasan-match-all-tag check is not implemented in __hwasan_load/__hwasan_store.
To support hwasan-match-all-tag in callback memory access instrumentation, we can
1. Pass hwasan-match-all-tag as an argument to __hwasan_load/__hwasan_store. That is add a set of callback functions: __hwasan_[load|store][1|2|4|8|16|n]_withmatchalltag and __hwasan_load[load|store][1|2|4|8|16|n]_noabort_withmatchalltag, add a template argument for CheckAddress/CheckAddressSized. Or
2. When instrument memory access with callback, simplily add a hwasan-match-all-tag check before the callback.
This patch implements the second approach, adds a hwasan-match-all-tag check before the callback, makes hwasan-match-all-tag flag working for callback memory access instrumentation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149580
Files:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/with-calls.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149580.518424.patch
Type: text/x-patch
Size: 10055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230501/8e80a367/attachment.bin>
More information about the llvm-commits
mailing list