[PATCH] D104275: [compiler-rt][hwasan] Add GetShadowOffset function
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 15 10:48:36 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfc006b3e5dc3: [compiler-rt][hwasan] Add GetShadowOffset function (authored by leonardchan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104275/new/
https://reviews.llvm.org/D104275
Files:
compiler-rt/lib/hwasan/hwasan_allocator.h
compiler-rt/lib/hwasan/hwasan_mapping.h
Index: compiler-rt/lib/hwasan/hwasan_mapping.h
===================================================================
--- compiler-rt/lib/hwasan/hwasan_mapping.h
+++ compiler-rt/lib/hwasan/hwasan_mapping.h
@@ -50,12 +50,14 @@
extern uptr kAliasRegionStart;
+inline uptr GetShadowOffset() {
+ return SANITIZER_FUCHSIA ? 0 : __hwasan_shadow_memory_dynamic_address;
+}
inline uptr MemToShadow(uptr untagged_addr) {
- return (untagged_addr >> kShadowScale) +
- __hwasan_shadow_memory_dynamic_address;
+ return (untagged_addr >> kShadowScale) + GetShadowOffset();
}
inline uptr ShadowToMem(uptr shadow_addr) {
- return (shadow_addr - __hwasan_shadow_memory_dynamic_address) << kShadowScale;
+ return (shadow_addr - GetShadowOffset()) << kShadowScale;
}
inline uptr MemToShadowSize(uptr size) {
return size >> kShadowScale;
Index: compiler-rt/lib/hwasan/hwasan_allocator.h
===================================================================
--- compiler-rt/lib/hwasan/hwasan_allocator.h
+++ compiler-rt/lib/hwasan/hwasan_allocator.h
@@ -15,6 +15,7 @@
#include "hwasan.h"
#include "hwasan_interface_internal.h"
+#include "hwasan_mapping.h"
#include "hwasan_poisoning.h"
#include "sanitizer_common/sanitizer_allocator.h"
#include "sanitizer_common/sanitizer_allocator_checks.h"
@@ -114,7 +115,7 @@
// Aliases are mapped next to shadow so that the upper bits match the shadow
// base.
return (addr >> kTaggableRegionCheckShift) ==
- (__hwasan_shadow_memory_dynamic_address >> kTaggableRegionCheckShift);
+ (GetShadowOffset() >> kTaggableRegionCheckShift);
#endif
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104275.352190.patch
Type: text/x-patch
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210615/d37fb46e/attachment.bin>
More information about the cfe-commits
mailing list