Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Issue 2400903002: Clear PermissionStatus::m_service in pre-finalizer

Created:
4 years, 2 months ago by haraken
Modified:
4 years, 2 months ago
CC:
chromium-reviews, mlamouri+watch-blink_chromium.org, blink-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Clear PermissionStatus::m_service in pre-finalizer Otherwise, there's a risk that Mojo's callback accesses the PermissionStatus object that is going to die in lazy sweeping. To prevent that from happening, we need to clear the service pointer before the lazy sweeping starts. BUG=653688

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -3 lines) Patch
M third_party/WebKit/Source/modules/permissions/PermissionStatus.h View 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/permissions/PermissionStatus.cpp View 1 chunk +4 lines, -2 lines 0 comments Download

Messages

Total messages: 8 (5 generated)
haraken
PTAL
4 years, 2 months ago (2016-10-07 01:45:07 UTC) #2
Reilly Grant (use Gerrit)
We talked about this offline but for posterity: This isn't the solution we want. wrapWeakPersistent() ...
4 years, 2 months ago (2016-10-07 02:05:49 UTC) #5
haraken
4 years, 2 months ago (2016-10-08 02:05:15 UTC) #8
On 2016/10/07 02:05:49, Reilly Grant wrote:
> We talked about this offline but for posterity: This isn't the solution we
want.
> wrapWeakPersistent() should already be preventing Mojo callbacks from
accessing
> the PermissionStatus object during lazy sweeping. The problem is that on
> shutdown (the crash in the linked bug is during MessageLoop destruction) the
> Oilpan heap is being destroyed without invalidating weak persistent pointers.

I tried to implement the approach but noticed that it won't work.

The problem here is NOT that ~MessageLoop is touching an Oilpan object pointed
to by the weak persistent handle but that ~MessageLoop is touching the weak
persistent handle. The memory region on which the weak persistent handle was
allocated has already been cleared by Oilpan's shutdown, so it crashes. In other
words, trying to clear weak persistent handles in Oilpan's shutdown won't help.

I suspect that there will be no easy work-around to this issue. The only way to
solve this problem is to leak MessageLoop or remove the shutdown sequence. I'm
actively working on it in https://codereview.chromium.org/2309153002, but it
will take a bit more time to land it.

Powered by Google App Engine
This is Rietveld 408576698