[PATCH] D86378: [tsan On arm64e, strip out ptrauth bits from incoming PCs
Kuba (Brecka) Mracek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 15:09:36 PDT 2020
kubamracek created this revision.
kubamracek added reviewers: dvyukov, delcypher, yln.
kubamracek added a project: Sanitizers.
Herald added subscribers: Sanitizers, danielkiss, kristof.beyls.
kubamracek requested review of this revision.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86378
Files:
compiler-rt/lib/tsan/rtl/tsan_interface_inl.h
Index: compiler-rt/lib/tsan/rtl/tsan_interface_inl.h
===================================================================
--- compiler-rt/lib/tsan/rtl/tsan_interface_inl.h
+++ compiler-rt/lib/tsan/rtl/tsan_interface_inl.h
@@ -12,8 +12,10 @@
#include "tsan_interface.h"
#include "tsan_rtl.h"
+#include "sanitizer_common/sanitizer_ptrauth.h"
#define CALLERPC ((uptr)__builtin_return_address(0))
+#define STRIP(pc) ((uptr)ptrauth_strip(pc, 0))
using namespace __tsan;
@@ -50,35 +52,35 @@
}
void __tsan_read1_pc(void *addr, void *pc) {
- MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog1);
+ MemoryRead(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog1);
}
void __tsan_read2_pc(void *addr, void *pc) {
- MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog2);
+ MemoryRead(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog2);
}
void __tsan_read4_pc(void *addr, void *pc) {
- MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog4);
+ MemoryRead(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog4);
}
void __tsan_read8_pc(void *addr, void *pc) {
- MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog8);
+ MemoryRead(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog8);
}
void __tsan_write1_pc(void *addr, void *pc) {
- MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog1);
+ MemoryWrite(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog1);
}
void __tsan_write2_pc(void *addr, void *pc) {
- MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog2);
+ MemoryWrite(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog2);
}
void __tsan_write4_pc(void *addr, void *pc) {
- MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog4);
+ MemoryWrite(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog4);
}
void __tsan_write8_pc(void *addr, void *pc) {
- MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog8);
+ MemoryWrite(cur_thread(), STRIP(pc), (uptr)addr, kSizeLog8);
}
void __tsan_vptr_update(void **vptr_p, void *new_val) {
@@ -100,7 +102,7 @@
}
void __tsan_func_entry(void *pc) {
- FuncEntry(cur_thread(), (uptr)pc);
+ FuncEntry(cur_thread(), STRIP(pc));
}
void __tsan_func_exit() {
@@ -124,9 +126,9 @@
}
void __tsan_read_range_pc(void *addr, uptr size, void *pc) {
- MemoryAccessRange(cur_thread(), (uptr)pc, (uptr)addr, size, false);
+ MemoryAccessRange(cur_thread(), STRIP(pc), (uptr)addr, size, false);
}
void __tsan_write_range_pc(void *addr, uptr size, void *pc) {
- MemoryAccessRange(cur_thread(), (uptr)pc, (uptr)addr, size, true);
+ MemoryAccessRange(cur_thread(), STRIP(pc), (uptr)addr, size, true);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86378.287122.patch
Type: text/x-patch
Size: 2590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/34e9372b/attachment.bin>
More information about the llvm-commits
mailing list