File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
compiler-rt/lib/scudo/standalone Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -785,6 +785,9 @@ class Allocator {
785
785
// A corrupted chunk will not be reported as owned, which is WAI.
786
786
bool isOwned (const void *Ptr) {
787
787
initThreadMaybe ();
788
+ // If the allocation is not owned, the tags could be wrong.
789
+ ScopedDisableMemoryTagChecks x (
790
+ useMemoryTagging<AllocatorConfig>(Primary.Options .load ()));
788
791
#ifdef GWP_ASAN_HOOKS
789
792
if (GuardedAlloc.pointerIsMine (Ptr))
790
793
return true ;
Original file line number Diff line number Diff line change @@ -122,9 +122,12 @@ inline NORETURN void enableSystemMemoryTaggingTestOnly() {
122
122
123
123
class ScopedDisableMemoryTagChecks {
124
124
uptr PrevTCO;
125
+ bool active;
125
126
126
127
public:
127
- ScopedDisableMemoryTagChecks () {
128
+ ScopedDisableMemoryTagChecks (bool cond = true ) : active(cond) {
129
+ if (!active)
130
+ return ;
128
131
__asm__ __volatile__ (
129
132
R"(
130
133
.arch_extension memtag
@@ -135,6 +138,8 @@ class ScopedDisableMemoryTagChecks {
135
138
}
136
139
137
140
~ScopedDisableMemoryTagChecks () {
141
+ if (!active)
142
+ return ;
138
143
__asm__ __volatile__ (
139
144
R"(
140
145
.arch_extension memtag
@@ -269,7 +274,7 @@ inline NORETURN void enableSystemMemoryTaggingTestOnly() {
269
274
}
270
275
271
276
struct ScopedDisableMemoryTagChecks {
272
- ScopedDisableMemoryTagChecks () {}
277
+ ScopedDisableMemoryTagChecks (UNUSED bool cond = true ) {}
273
278
};
274
279
275
280
inline NORETURN uptr selectRandomTag (uptr Ptr, uptr ExcludeMask) {
You can’t perform that action at this time.
0 commit comments