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

Issue 1862073002: Let AssociatedURLLoader listen to destruction of the Document used for loading (Closed)

Created:
4 years, 8 months ago by tyoshino (SeeGerritForStatus)
Modified:
4 years, 8 months ago
Reviewers:
haraken, yhirano
CC:
chromium-reviews, blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Let AssociatedURLLoader listen to destruction of the Document used for loading The DocumentThreadableLoader instance used by AssociatedURLLoader must stop using objects on Oilpan heap before blink::shutdown() is called. This CL adds a small helper class to observe destruction of the Document associated with the passed frame by using ContextLifecycleObserver. I chose to use a small helper class than making AssociatedURLLoader as it requires a lot of changes to make the users hold it using Persistent. Since ContextLifecycleObserver::contextDestoryed() won't be invoked for some kind of Documents, in such case, we crash the process by checking ThreadState::current(). BUG=588566 R=yhirano,haraken Committed: https://crrev.com/7a247ee1edbb291fbbb5377a3b2073e1e83ce803 Cr-Commit-Position: refs/heads/master@{#386044}

Patch Set 1 #

Patch Set 2 : Prevent documentStopped() call after destruction of AssociatedURLLoader #

Total comments: 4

Patch Set 3 : Addressed #10 and cleaned up code #

Patch Set 4 : Use ContextLifecycleObserver than DocumentLifecycleObserver #

Patch Set 5 : Fixed crash #

Total comments: 1

Patch Set 6 : Add release assert #

Patch Set 7 : Added comment to RELEASE_ASSERT #

Total comments: 6

Patch Set 8 : Addressed #38 #

Patch Set 9 : Addressed #37 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+107 lines, -24 lines) Patch
M third_party/WebKit/Source/web/AssociatedURLLoader.h View 1 2 3 4 5 6 7 8 1 chunk +14 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/web/AssociatedURLLoader.cpp View 1 2 3 4 5 6 7 9 chunks +93 lines, -21 lines 0 comments Download

Messages

Total messages: 51 (19 generated)
tyoshino (SeeGerritForStatus)
4 years, 8 months ago (2016-04-06 14:08:22 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/1
4 years, 8 months ago (2016-04-06 14:08:26 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/20001
4 years, 8 months ago (2016-04-06 14:13:47 UTC) #7
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/206473)
4 years, 8 months ago (2016-04-06 15:01:04 UTC) #9
yhirano
https://codereview.chromium.org/1862073002/diff/20001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp File third_party/WebKit/Source/web/AssociatedURLLoader.cpp (right): https://codereview.chromium.org/1862073002/diff/20001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp#newcode291 third_party/WebKit/Source/web/AssociatedURLLoader.cpp:291: class AssociatedURLLoader::DocumentWatcher final : public GarbageCollectedFinalized<DocumentWatcher>, public ActiveDOMObject { ...
4 years, 8 months ago (2016-04-07 01:46:42 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/40001
4 years, 8 months ago (2016-04-07 05:24:11 UTC) #12
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/1862073002/diff/20001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp File third_party/WebKit/Source/web/AssociatedURLLoader.cpp (right): https://codereview.chromium.org/1862073002/diff/20001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp#newcode291 third_party/WebKit/Source/web/AssociatedURLLoader.cpp:291: class AssociatedURLLoader::DocumentWatcher final : public GarbageCollectedFinalized<DocumentWatcher>, public ActiveDOMObject { ...
4 years, 8 months ago (2016-04-07 05:54:06 UTC) #13
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/60001
4 years, 8 months ago (2016-04-07 05:54:21 UTC) #15
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_blink_oilpan_rel on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_blink_oilpan_rel/builds/27924)
4 years, 8 months ago (2016-04-07 06:31:04 UTC) #17
tyoshino (SeeGerritForStatus)
I'll investigate the oilpan crash.
4 years, 8 months ago (2016-04-07 06:37:44 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/80001
4 years, 8 months ago (2016-04-07 09:01:06 UTC) #20
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 8 months ago (2016-04-07 10:08:06 UTC) #22
yhirano1
PS5 crashes in my envornment: ==36966==ERROR: AddressSanitizer: SEGV on unknown address 0x7e8e3aecf680 (pc 0x0001129580dc bp ...
4 years, 8 months ago (2016-04-07 10:26:40 UTC) #23
yhirano
https://codereview.chromium.org/1862073002/diff/80001/third_party/WebKit/Source/web/AssociatedURLLoader.h File third_party/WebKit/Source/web/AssociatedURLLoader.h (right): https://codereview.chromium.org/1862073002/diff/80001/third_party/WebKit/Source/web/AssociatedURLLoader.h#newcode60 third_party/WebKit/Source/web/AssociatedURLLoader.h:60: // Called by |m_observer| to handle destruction of the ...
4 years, 8 months ago (2016-04-07 10:29:42 UTC) #24
tyoshino (SeeGerritForStatus)
On 2016/04/07 10:26:40, yhirano1 wrote: > PS5 crashes in my envornment: > > ==36966==ERROR: AddressSanitizer: ...
4 years, 8 months ago (2016-04-07 15:06:49 UTC) #25
tyoshino (SeeGerritForStatus)
yhirano@, please test PS6
4 years, 8 months ago (2016-04-08 06:39:14 UTC) #26
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/100001
4 years, 8 months ago (2016-04-08 06:39:56 UTC) #28
tyoshino (SeeGerritForStatus)
+haraken yhirano@ confirmed that this fix works by following the Clusterfuzz reproduction steps.
4 years, 8 months ago (2016-04-08 07:13:03 UTC) #32
yhirano
I saw no UAF-reports with PS6.
4 years, 8 months ago (2016-04-08 07:13:27 UTC) #33
yhirano
Adding comments at RELEASE_ASSERT would be good.
4 years, 8 months ago (2016-04-08 07:14:09 UTC) #34
tyoshino (SeeGerritForStatus)
On 2016/04/08 07:14:09, yhirano wrote: > Adding comments at RELEASE_ASSERT would be good. Done
4 years, 8 months ago (2016-04-08 07:18:32 UTC) #35
tyoshino (SeeGerritForStatus)
I chose to preserve the Observer code as for most of Documents it should just ...
4 years, 8 months ago (2016-04-08 07:19:42 UTC) #36
yhirano
lgtm https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.h File third_party/WebKit/Source/web/AssociatedURLLoader.h (right): https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.h#newcode77 third_party/WebKit/Source/web/AssociatedURLLoader.h:77: // A DocumentLifecycleObserver for cancelling |m_loader| when the ...
4 years, 8 months ago (2016-04-08 07:24:02 UTC) #37
haraken
https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp File third_party/WebKit/Source/web/AssociatedURLLoader.cpp (right): https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp#newcode443 third_party/WebKit/Source/web/AssociatedURLLoader.cpp:443: // The method of detecting Document destruction implemented here ...
4 years, 8 months ago (2016-04-08 07:34:13 UTC) #38
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp File third_party/WebKit/Source/web/AssociatedURLLoader.cpp (right): https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.cpp#newcode443 third_party/WebKit/Source/web/AssociatedURLLoader.cpp:443: // The method of detecting Document destruction implemented here ...
4 years, 8 months ago (2016-04-08 07:56:58 UTC) #39
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.h File third_party/WebKit/Source/web/AssociatedURLLoader.h (right): https://codereview.chromium.org/1862073002/diff/120001/third_party/WebKit/Source/web/AssociatedURLLoader.h#newcode77 third_party/WebKit/Source/web/AssociatedURLLoader.h:77: // A DocumentLifecycleObserver for cancelling |m_loader| when the Document ...
4 years, 8 months ago (2016-04-08 07:57:26 UTC) #40
tyoshino (SeeGerritForStatus)
Confirmed that the Document instance is created by using DOMImplementation::createDocument() which is mentioned as an ...
4 years, 8 months ago (2016-04-08 08:18:25 UTC) #41
haraken
LGTM as a short-term fix. However, I don't think this is a right fix -- ...
4 years, 8 months ago (2016-04-08 09:29:31 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862073002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862073002/160001
4 years, 8 months ago (2016-04-08 09:55:38 UTC) #46
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 8 months ago (2016-04-08 11:11:18 UTC) #48
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/7a247ee1edbb291fbbb5377a3b2073e1e83ce803 Cr-Commit-Position: refs/heads/master@{#386044}
4 years, 8 months ago (2016-04-08 11:12:56 UTC) #50
tyoshino (SeeGerritForStatus)
4 years, 8 months ago (2016-04-11 05:03:39 UTC) #51
Message was sent while issue was closed.
On 2016/04/08 09:29:31, haraken wrote:
> LGTM as a short-term fix.
> 
> However, I don't think this is a right fix -- I think content/ should have
logic
> to clear all running loaders before calling blink::shutdown (without relying
on
> ContextLifecycleObservers).

Thanks. I agree. Spawned http://crbug.com/601737 for long-term fix.

Powered by Google App Engine
This is Rietveld 408576698