Crash in blink::ThreadState::freePersistentNode |
||||||
Issue descriptionDetailed report: https://cluster-fuzz.appspot.com/testcase?key=4572050421448704 Fuzzer: inferno_twister Job Type: mac_asan_content_shell Platform Id: mac Crash Type: UNKNOWN READ Crash Address: 0x000000000010 Crash State: blink::ThreadState::freePersistentNode blink::WebRTCCertificateObserver::~WebRTCCertificateObserver base::internal::BindState<void Regressed: https://cluster-fuzz.appspot.com/revisions?job=mac_asan_content_shell&range=389432:389450 Minimized Testcase (0.17 Kb): https://cluster-fuzz.appspot.com/download/AMIfv97UDcVcHQbNRnCcQBEY7X5uDhv1Pf6gWVrGJFPOx4j5olLGNsA2zVCU9zidznFnlp9rEJPKMGkCZSdZFZyMrIrNb2LQ-W2bDuKKpVaNi-PpnQtNIqJ_4KLO3uRDBwtXg7E0EyoKr6ad-0TxQcVddlaSOF6JUw?testcase_id=4572050421448704 Filer: nyerramilli See https://dev.chromium.org/Home/chromium-security/bugs/reproducing-clusterfuzz-bugs for more information.
,
Jul 14 2016
The problem here is that RTCCertificateGeneratorRequest passes an WebRTCCertificateObserver object along to a worker thread for async cert generation, the main thread is then detached and shut down. The worker thread completes and then tries to post back to the main thread. And fails when trying to release the Persistent<> that WebRTCCertificateObserver. I don't quite understand why GenerateCertificateOnWorkerThread() gets to destruct the WebRTCCertificateObserver it is passed, https://cs.chromium.org/chromium/src/content/renderer/media/rtc_certificate_generator.cc?q=GenerateCertificateOnWorkerThread&sq=package:chromium&l=74 but perhaps it ends up being copied via Passed()? (Cc:ing hiroshige@ , who might have insights) If it is doing so and this is considered intended, then using Persistent<> is inappropriate (CrossThreadPersistent<> would be needed), but there seems to be a bigger shutdown coordination problem here -- accessing objects in the main thread's heap after it has been detached is not going to work. Re-assigning to hbos@ due to this touching on rtc_peer_connection.cc details.
,
Jul 14 2016
,
Jul 15 2016
#c2: Agree. This looks a shutdown ordering problem to me. The worker thread is stopped in PeerConnectionDependencyFactory::WillDestroyCurrentMessageLoop, which is called after the MessageLoop stop accepting tasks and after Blink shutdown. I think the thread should shutdown earlier.
,
Jul 15 2016
The WebRTCCertificateObserver is not copied, it is a pointer to it that is being Passed with a unique_ptr. It will be deleted when the message is destroyed (message has been executed or loop is shutdown). As pointed out by tzik@, because it is holding a Persistent<> of a Blink object the observer must not be destroyed after Blink shutdown. tzik@'s CL (https://codereview.chromium.org/2156483002/) I think should fix this. Good job.
,
Jul 15 2016
I think the change looks good. But be aware of that the change your are reverting was made to fix https://bugs.chromium.org/p/chromium/issues/detail?id=434972 Can you please test that #2 is not broken by this.
,
Jul 19 2016
Hmm, looks like my CL may cause the same issue that http://crbug.com/434972 . On my quick scan, WebRTC system's |signaling_thread| and |worker_thread| have to outlive the main thread, since proxy classes defined by BEGIN_{,SIGNALING_}PROXY_MAP() depend on these threads, and since they are RefCountInterface, their lifetime can be unpredictably long. OTOH, Blink's GCed object need to be destroyed before Blink heap is terminated, which is before the main thread shutdown.
,
Jul 19 2016
There's two separate issues that causes the crash: 1. blink::Persistent has to be destroyed before blink::ThreadState shutdown. However, some blink::Persistent can be left in the message queue, and deleted on base::MessageLoop destruction after blink::ThreadState shutdown. 2. blink::Persistent can't be brought to the other thread than the original thread, though WebRTCCertificateObserver takes a Persistent to the WebRTC worker thread. In normal case, the instance moves back to the main thread, but if it failed to go back to the main thread, it's destroyed on the worker thread. https://codereview.chromium.org/2164503002/ will fix (1) part, and https://codereview.chromium.org/2159123002/ will fix (2).
,
Aug 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/edbd386e6c520cf327e530f65988587eea25d65c commit edbd386e6c520cf327e530f65988587eea25d65c Author: tzik <tzik@chromium.org> Date: Mon Aug 15 15:12:12 2016 Do not delete blink::WebRTCCertificateCallback on non-main thread blink::WebRTCCertificateCallback has a blink::Persistent, which can not be destroyed on the original thread. However, RTC implementation brings it to a worker thread and occasionally deletes it on that thread, in case the main thread is already gone. This CL replaces the deleter of the std::unique_ptr that holds WebRTCCertificateCallback with OnTaskRunnerDeleter, which ensures the objects is deleted on the original thread. BUG= 627004 Review-Url: https://codereview.chromium.org/2164503002 Cr-Commit-Position: refs/heads/master@{#411965} [modify] https://crrev.com/edbd386e6c520cf327e530f65988587eea25d65c/base/BUILD.gn [modify] https://crrev.com/edbd386e6c520cf327e530f65988587eea25d65c/base/base.gyp [modify] https://crrev.com/edbd386e6c520cf327e530f65988587eea25d65c/base/sequenced_task_runner.cc [modify] https://crrev.com/edbd386e6c520cf327e530f65988587eea25d65c/base/sequenced_task_runner.h [add] https://crrev.com/edbd386e6c520cf327e530f65988587eea25d65c/base/sequenced_task_runner_unittest.cc [modify] https://crrev.com/edbd386e6c520cf327e530f65988587eea25d65c/content/renderer/media/rtc_certificate_generator.cc
,
Aug 17 2016
ClusterFuzz has detected this issue as fixed in range 408378:408381. Detailed report: https://cluster-fuzz.appspot.com/testcase?key=4572050421448704 Fuzzer: inferno_twister Job Type: mac_asan_content_shell Platform Id: mac Crash Type: UNKNOWN READ Crash Address: 0x000000000010 Crash State: blink::ThreadState::freePersistentNode blink::WebRTCCertificateObserver::~WebRTCCertificateObserver base::internal::BindState<void Regressed: https://cluster-fuzz.appspot.com/revisions?job=mac_asan_content_shell&range=389432:389450 Fixed: https://cluster-fuzz.appspot.com/revisions?job=mac_asan_content_shell&range=408378:408381 Minimized Testcase (0.17 Kb): https://cluster-fuzz.appspot.com/download/AMIfv97UDcVcHQbNRnCcQBEY7X5uDhv1Pf6gWVrGJFPOx4j5olLGNsA2zVCU9zidznFnlp9rEJPKMGkCZSdZFZyMrIrNb2LQ-W2bDuKKpVaNi-PpnQtNIqJ_4KLO3uRDBwtXg7E0EyoKr6ad-0TxQcVddlaSOF6JUw?testcase_id=4572050421448704 See https://dev.chromium.org/Home/chromium-security/bugs/reproducing-clusterfuzz-bugs for more information. If you suspect that the result above is incorrect, try re-doing that job on the test case report page.
,
Aug 17 2016
ClusterFuzz testcase is verified as fixed, closing issue. If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.
,
Nov 22 2016
Removing EditIssue view restrictions from ClusterFuzz filed bugs. If you believe that this issue should still be restricted, please reapply the label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by nyerramilli@chromium.org
, Jul 11 2016Components: Tools>Test>FindIt>CorrectResult
Labels: findit-for-crash Te-Logged M-52
Owner: sigbjo...@opera.com
Status: Assigned (was: Available)