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
- rCRT Compiler Runtime
- Build Status
Buildable 31467 Build 31466: arc lint + arc unit
Event Timeline
lib/scudo/standalone/quarantine.h | ||
---|---|---|
139 | Does range-based loop work here? | |
158 | Since uptr, probably want %zd for all. | |
182 | What range of MaxCacheSize will Scudo allow? I notice you removed handling for MaxCacheSize == 0 in put below. | |
189 | I think these can be initLinkerInitialized. | |
189 | 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 | ||
---|---|---|
139 | If you could please clarify, I am unsure as to which range you are referring to. | |
182 | 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. | |
189 | 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
Does range-based loop work here?