Skip to content

Commit 0e07bf9

Browse files
authored
[NFC][sanitizer] Rename to Lock{Before,After}Fork StackDepotBase locking (#76303)
Followup to #76279
1 parent 061e4f2 commit 0e07bf9

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

compiler-rt/lib/dfsan/dfsan_chained_origin_depot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ static ChainedOriginDepot chainedOriginDepot;
1919

2020
ChainedOriginDepot* GetChainedOriginDepot() { return &chainedOriginDepot; }
2121

22-
void ChainedOriginDepotLockBeforeFork() { chainedOriginDepot.LockAll(); }
22+
void ChainedOriginDepotLockBeforeFork() { chainedOriginDepot.LockBeforeFork(); }
2323

2424
void ChainedOriginDepotUnlockAfterFork(bool fork_child) {
25-
chainedOriginDepot.UnlockAll();
25+
chainedOriginDepot.UnlockAfterFork(fork_child);
2626
}
2727

2828
} // namespace __dfsan

compiler-rt/lib/msan/msan_chained_origin_depot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ u32 ChainedOriginDepotGet(u32 id, u32 *other) {
3131
return chainedOriginDepot.Get(id, other);
3232
}
3333

34-
void ChainedOriginDepotBeforeFork() { chainedOriginDepot.LockAll(); }
34+
void ChainedOriginDepotBeforeFork() { chainedOriginDepot.LockBeforeFork(); }
3535

3636
void ChainedOriginDepotAfterFork(bool fork_child) {
37-
chainedOriginDepot.UnlockAll();
37+
chainedOriginDepot.UnlockAfterFork(fork_child);
3838
}
3939

4040
} // namespace __msan

compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ u32 ChainedOriginDepot::Get(u32 id, u32 *other) {
139139
return desc.here_id;
140140
}
141141

142-
void ChainedOriginDepot::LockAll() { depot.LockAll(); }
142+
void ChainedOriginDepot::LockBeforeFork() { depot.LockBeforeFork(); }
143143

144-
void ChainedOriginDepot::UnlockAll() { depot.UnlockAll(); }
144+
void ChainedOriginDepot::UnlockAfterFork(bool fork_child) {
145+
depot.UnlockAfterFork(fork_child);
146+
}
145147

146148
void ChainedOriginDepot::TestOnlyUnmap() { depot.TestOnlyUnmap(); }
147149

compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class ChainedOriginDepot {
3232
// Retrieves the stored StackDepot ID for the given origin ID.
3333
u32 Get(u32 id, u32 *other);
3434

35-
void LockAll();
36-
void UnlockAll();
35+
void LockBeforeFork();
36+
void UnlockAfterFork(bool fork_child);
3737
void TestOnlyUnmap();
3838

3939
private:

compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ StackTrace StackDepotGet(u32 id) {
216216
}
217217

218218
void StackDepotLockBeforeFork() {
219-
theDepot.LockAll();
219+
theDepot.LockBeforeFork();
220220
compress_thread.LockAndStop();
221221
stackStore.LockAll();
222222
}
223223

224224
void StackDepotUnlockAfterFork(bool fork_child) {
225225
stackStore.UnlockAll();
226226
compress_thread.Unlock();
227-
theDepot.UnlockAll();
227+
theDepot.UnlockAfterFork(fork_child);
228228
}
229229

230230
void StackDepotPrintAll() {

compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class StackDepotBase {
5252
};
5353
}
5454

55-
void LockAll();
56-
void UnlockAll();
55+
void LockBeforeFork();
56+
void UnlockAfterFork(bool fork_child);
5757
void PrintAll();
5858

5959
void TestOnlyUnmap() {
@@ -160,14 +160,15 @@ StackDepotBase<Node, kReservedBits, kTabSizeLog>::Get(u32 id) {
160160
}
161161

162162
template <class Node, int kReservedBits, int kTabSizeLog>
163-
void StackDepotBase<Node, kReservedBits, kTabSizeLog>::LockAll() {
163+
void StackDepotBase<Node, kReservedBits, kTabSizeLog>::LockBeforeFork() {
164164
for (int i = 0; i < kTabSize; ++i) {
165165
lock(&tab[i]);
166166
}
167167
}
168168

169169
template <class Node, int kReservedBits, int kTabSizeLog>
170-
void StackDepotBase<Node, kReservedBits, kTabSizeLog>::UnlockAll() {
170+
void StackDepotBase<Node, kReservedBits, kTabSizeLog>::UnlockAfterFork(
171+
bool fork_child) {
171172
for (int i = 0; i < kTabSize; ++i) {
172173
atomic_uint32_t *p = &tab[i];
173174
uptr s = atomic_load(p, memory_order_relaxed);

0 commit comments

Comments
 (0)