diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-05-26 08:14:39 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-05-26 08:14:57 -0400 |
commit | fe1357a03af108c41baa6bd31903f2cfb0d75ef5 (patch) | |
tree | 79395357aae57300859d1c25416a666a9a33068e /src/qt/winshutdownmonitor.h | |
parent | 13397dc78fd6a6a57bdc91db66c51788603267bb (diff) | |
parent | 90eb027204f5a9d7c00fa97d4112243bd37a9012 (diff) |
Merge #18881: Prevent UB in DeleteLock() function
90eb027204f5a9d7c00fa97d4112243bd37a9012 doc: Add and fix comments about never destroyed objects (Hennadii Stepanov)
26c093a9957756f3743c2347fe0abd90f81159c4 Replace thread_local g_lockstack with a mutex-protected map (Hennadii Stepanov)
58e6881bc5be002e8ddbc9b75422c0deae66a2df refactor: Refactor duplicated code into LockHeld() (Hennadii Stepanov)
f511f61dda4e860079153d5e51d64658cc265283 refactor: Add LockPair type alias (Hennadii Stepanov)
8d8921abd35c3ac1b8ebacb11de8e1bbc7b28d66 refactor: Add LockStackItem type alias (Hennadii Stepanov)
458992b06d80eb568141f60a33d38e12e894e27a Prevent UB in DeleteLock() function (Hennadii Stepanov)
Pull request description:
Tracking our instrumented mutexes (`Mutex` and `RecursiveMutex` types) requires that all involved objects should not be destroyed until after their last use. On master (ec79b5f86b22ad8f77c736f9bb76c2e4d7faeaa4) we have two problems related to the object destroying order:
- the function-local `static` `lockdata` object that is destroyed at [program exit](https://en.cppreference.com/w/cpp/utility/program/exit)
- the `thread_local` `g_lockstack` that is destroyed at [thread exit](https://en.cppreference.com/w/cpp/language/destructor)
Both cases could cause UB at program exit in so far as mutexes are used in other static object destructors.
Fix #18824
ACKs for top commit:
MarcoFalke:
re-ACK 90eb027204, only change is new doc commit ðŸ‘
ryanofsky:
Code review ACK 90eb027204f5a9d7c00fa97d4112243bd37a9012 because all the changes look correct and safe. But I don't know the purpose of commit 26c093a9957756f3743c2347fe0abd90f81159c4 "Replace thread_local g_lockstack with a mutex-protected map (5/6)." It seems like it could have a bad impact on debug performance, and the commit message and PR description don't give a reason for the change.
Tree-SHA512: 99f29157fd1278994e3f6eebccedfd9dae540450f5f8b980518345a89d56b635f943a85b20864cef087027fd0fcdb4880b659ef59bfe5626d110452ae22031c6
Diffstat (limited to 'src/qt/winshutdownmonitor.h')
0 files changed, 0 insertions, 0 deletions