[M108 Aura Migration][NaCl][PPAPI] Crash during PPB_MessageLoop destruction 29/289629/2
authorjinbei09 <jinbei09.dai@samsung.com>
Fri, 10 Mar 2023 11:18:12 +0000 (19:18 +0800)
committerBot Blink <blinkbot@samsung.com>
Tue, 28 Mar 2023 04:19:32 +0000 (04:19 +0000)
When MessageLoop for PPAPI is destroyed it may happen that there are
some unrun callbacks. Dtor of such callback tries to acquire global
proxy lock.

If such destroy is called from during call to method exposed via PPAPI
to the plugin then deadlock occurs as global proxy lock is held
EnterResource object form Thunk layer.

Ported patch from Tizen 7.0:
  https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/280223/

Change-Id: If50242a099ce4c95f42148cd38c565314558359c
Signed-off-by: jinbei09 <jinbei09.dai@samsung.com>
ppapi/proxy/ppb_message_loop_proxy.cc

index 06aded8..e695734 100644 (file)
@@ -124,7 +124,11 @@ int32_t MessageLoopResource::Run() {
 
   if (should_destroy_ && nested_invocations_ == 0) {
     task_runner_.reset();
-    single_thread_task_executor_.reset();
+    {
+      // Message Loop dtor may try to aquire lock.
+      ProxyAutoUnlock lock;
+      single_thread_task_executor_.reset();
+    }
     destroyed_ = true;
   }
   return PP_OK;