The Quarantine is used to hold chunks for a little while prior to
actually releasing them for potential reuse. The code is pretty much
the same as the sanitizer_common one, with additional shuffling of
the quarantine batches to decrease predictability of allocation
patterns when it is enabled.
Details
- Reviewers
vitalybuka eugenis hctim morehouse - Commits
- rZORGe8345012b232: [scudo][standalone] Introduce the Quarantine
rZORG43783ef22c19: [scudo][standalone] Introduce the Quarantine
rGe8345012b232: [scudo][standalone] Introduce the Quarantine
rG43783ef22c19: [scudo][standalone] Introduce the Quarantine
rGab8c8da60928: [scudo][standalone] Introduce the Quarantine
rCRT360163: [scudo][standalone] Introduce the Quarantine
rL360163: [scudo][standalone] Introduce the Quarantine
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/scudo/standalone/quarantine.h | ||
---|---|---|
138 ↗ | (On Diff #197568) | Does range-based loop work here? |
157 ↗ | (On Diff #197568) | Since uptr, probably want %zd for all. |
181 ↗ | (On Diff #197568) | What range of MaxCacheSize will Scudo allow? I notice you removed handling for MaxCacheSize == 0 in put below. |
188 ↗ | (On Diff #197568) | I think these can be initLinkerInitialized. |
188 ↗ | (On Diff #197568) | Right now it's a no-op, but I think we should call Cache.initLinkerInitialized here too in case a future change makes it not a no-op. |
lib/scudo/standalone/quarantine.h | ||
---|---|---|
138 ↗ | (On Diff #197568) | If you could please clarify, I am unsure as to which range you are referring to. |
181 ↗ | (On Diff #197568) | This is due to the fact that the Combined will skip a put and directly deallocate a chunk if:
This is the current behavior of Scudo with quarantineOrDeallocateChunk, except that since we were using the sanitizer_common Quarantine, the put were doing an extraneous comparison. As for range of values, they will likely be identical to the ones currently implemented in the non-standalone version. |
188 ↗ | (On Diff #197568) | Thanks, it turned out StaticMutex didn't have an initLinkerInitialized, so I added one. |
Addressing Matt's comments:
- changing some initializers to initLinkerInitialized. This also required implementing a no-op version of this function for StaticSpinMutex
- changed a %d to %zd
Addressing Matt's new comments:
- changing another %d to %zd
- changing the iterating loop to a range loop
- clang-format'ing the source