From 5a1d5e88371a914a580b55f2edc7ba130c41f221 Mon Sep 17 00:00:00 2001 From: Robert Shih Date: Tue, 5 Apr 2022 00:44:38 +0000 Subject: [PATCH] WVCdm: no destroy global log buffer on exit [ Merge of go/wvgerrit/149989 ] Bug: 227848537 Change-Id: I9407b133654c20ddcd3c15404dd19b3719064e6e Test: Irdeto monkey test --- libwvdrmengine/cdm/util/src/log.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libwvdrmengine/cdm/util/src/log.cpp b/libwvdrmengine/cdm/util/src/log.cpp index 8dedcc5c..d9fc58ae 100644 --- a/libwvdrmengine/cdm/util/src/log.cpp +++ b/libwvdrmengine/cdm/util/src/log.cpp @@ -57,7 +57,11 @@ int64_t GetCurrentTimeMs() { LogPriority g_cutoff = CDM_LOG_VERBOSE; -LogBuffer g_logbuf; +// This LogBuffer instance shares its mutex with multiple +// threads which might not release the mutex if suddenly closed +// by a signal. Destroying an in-use mutex may cause a process +// crash. Leave memory clean to the kernel when the process exits. +[[clang::no_destroy]] LogBuffer g_logbuf; thread_local bool tl_logging_uid_set_ = false;