[PATCH] D70552: [scudo][standalone] Fix for releaseToOS prior to init
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 08:43:07 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG15664fe2c48b: [scudo][standalone] Fix for releaseToOS prior to init (authored by cryptoad).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70552/new/
https://reviews.llvm.org/D70552
Files:
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
Index: compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -279,3 +279,18 @@
EXPECT_DEATH(Allocator->reallocate(P, Size * 2U), "");
EXPECT_DEATH(Allocator->getUsableSize(P), "");
}
+
+// Ensure that releaseToOS can be called prior to any other allocator
+// operation without issue.
+TEST(ScudoCombinedTest, ReleaseToOS) {
+ using AllocatorT = scudo::Allocator<DeathConfig>;
+ auto Deleter = [](AllocatorT *A) {
+ A->unmapTestOnly();
+ delete A;
+ };
+ std::unique_ptr<AllocatorT, decltype(Deleter)> Allocator(new AllocatorT,
+ Deleter);
+ Allocator->reset();
+
+ Allocator->releaseToOS();
+}
Index: compiler-rt/lib/scudo/standalone/combined.h
===================================================================
--- compiler-rt/lib/scudo/standalone/combined.h
+++ compiler-rt/lib/scudo/standalone/combined.h
@@ -402,7 +402,10 @@
Str.output();
}
- void releaseToOS() { Primary.releaseToOS(); }
+ void releaseToOS() {
+ initThreadMaybe();
+ Primary.releaseToOS();
+ }
// Iterate over all chunks and call a callback for all busy chunks located
// within the provided memory range. Said callback must not use this allocator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70552.230911.patch
Type: text/x-patch
Size: 1422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191125/b363fe7f/attachment.bin>
More information about the llvm-commits
mailing list