Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa822c66 authored by Ray Essick's avatar Ray Essick
Browse files

suppress end-of-process destruction of several static variables

resolve some UAF failures where the automatic deconstruction of static
classes as part of exit()/exitat() processing was removing a lock that was
sometimes referenced by a different still-running thread in the process.

Bug: 194783918
Test: screenrecord`
Change-Id: Ie38c24b46813db198d07de421db9240f3dad36a2
parent f521e485
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -354,8 +354,11 @@ status_t MediaCodec::ResourceManagerServiceProxy::init() {
}

//static
Mutex MediaCodec::ResourceManagerServiceProxy::sLockCookies;
std::set<void*> MediaCodec::ResourceManagerServiceProxy::sCookies;
// these are no_destroy to keep them from being destroyed at process exit
// where some thread calls exit() while other threads are still running.
// see b/194783918
[[clang::no_destroy]] Mutex MediaCodec::ResourceManagerServiceProxy::sLockCookies;
[[clang::no_destroy]] std::set<void*> MediaCodec::ResourceManagerServiceProxy::sCookies;

//static
void MediaCodec::ResourceManagerServiceProxy::addCookie(void* cookie) {