-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[scudo] Avoid accessing inaccessible pages in unmap() in secondary #102367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: None (ChiaHungDuan) ChangesFull diff: https://github.com/llvm/llvm-project/pull/102367.diff 1 Files Affected:
diff --git a/compiler-rt/lib/scudo/standalone/secondary.h b/compiler-rt/lib/scudo/standalone/secondary.h
index a9a7c2c8ea8618..27d11dce646dc3 100644
--- a/compiler-rt/lib/scudo/standalone/secondary.h
+++ b/compiler-rt/lib/scudo/standalone/secondary.h
@@ -823,7 +823,11 @@ void MapAllocator<Config>::deallocate(const Options &Options, void *Ptr)
Cache.store(Options, H->CommitBase, H->CommitSize,
reinterpret_cast<uptr>(H + 1), H->MemMap);
} else {
- unmap(H->MemMap);
+ // Note that the `H->MapMap` is stored on the pages managed by itself. Take
+ // over the ownership before unmap() so that any operation along with
+ // unmap() won't touch inaccessible pages.
+ MemMapT MemMap = H->MemMap;
+ unmap(MemMap);
}
}
|
@Caslyn , could you help verify if this fixes the problem on Fuchsia? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment nit.
@@ -823,7 +823,11 @@ void MapAllocator<Config>::deallocate(const Options &Options, void *Ptr) | |||
Cache.store(Options, H->CommitBase, H->CommitSize, | |||
reinterpret_cast<uptr>(H + 1), H->MemMap); | |||
} else { | |||
unmap(H->MemMap); | |||
// Note that the `H->MapMap` is stored on the pages managed by itself. Take |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MemMap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming this clears up issues in Fuchsia - thanks for this fix!
No description provided.