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

Issue 2469673002: Invalidate WeakPtrs of ResourceMessageFilter on channel shutdown (Closed)

Created:
4 years, 1 month ago by tzik
Modified:
4 years, 1 month ago
Reviewers:
yhirano, mmenke
CC:
chromium-reviews, loading-reviews_chromium.org, jam, darin-cc_chromium.org, Randy Smith (Not in Mondays), Ken Rockot(use gerrit already), horo
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Invalidate WeakPtrs of ResourceMessageFilter on channel shutdown ResourceMessageFilter is a RefCountedThreadSafe object with WeakPtrFactory. This kind of object tends to have potential UAF flaw as: 1. The refcount gets to zero on UI thread. 2. ResourceMessageFilter::OnDestruct posts a deletion task to IO thread. 3. Someone creates a scoped_refptr from a WeakPtr on IO thread, then increments the refcount to 1. 4. The task posted at (2) arrives at IO thread and deletes ResourceMessageFilter. 5. The scoped_refptr at (3) goes away and decrease the refcount to 0 again. This CL invalidates all WeakPtr to ResourceMessageFilter on the channel shutdown, and prevents further WeakPtr creation, so that the scenario above doesn't happen. Committed: https://crrev.com/5c734abad3035cfcb14b6510a152cd945146e6bd Cr-Commit-Position: refs/heads/master@{#432746}

Patch Set 1 #

Patch Set 2 : +test #

Patch Set 3 : fix #

Patch Set 4 : fix #

Patch Set 5 : rebase #

Patch Set 6 : fix #

Patch Set 7 : fix #

Patch Set 8 : fix #

Patch Set 9 : rebase #

Total comments: 8

Patch Set 10 : +override. +comment. #

Total comments: 7

Patch Set 11 : remove test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+44 lines, -2 lines) Patch
M content/browser/loader/async_resource_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/loader/async_revalidation_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/loader/resource_dispatcher_host_unittest.cc View 1 2 3 4 5 6 7 8 9 13 chunks +27 lines, -0 lines 0 comments Download
M content/browser/loader/resource_message_filter.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/loader/resource_message_filter.cc View 1 2 3 4 5 6 7 8 9 3 chunks +12 lines, -2 lines 0 comments Download
M content/browser/loader/url_loader_factory_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 65 (49 generated)
tzik
PTAL
4 years, 1 month ago (2016-11-02 07:36:08 UTC) #31
yhirano
lgtm
4 years, 1 month ago (2016-11-07 04:48:57 UTC) #38
tzik
Adding mmenke as a //content/browser/loader owner, PTAL. CC: rockot, horo. JFYI.
4 years, 1 month ago (2016-11-07 05:03:38 UTC) #40
mmenke
On 2016/11/07 05:03:38, tzik wrote: > Adding mmenke as a //content/browser/loader owner, PTAL. > > ...
4 years, 1 month ago (2016-11-07 15:33:20 UTC) #41
mmenke
On 2016/11/07 15:33:20, mmenke wrote: > On 2016/11/07 05:03:38, tzik wrote: > > Adding mmenke ...
4 years, 1 month ago (2016-11-09 18:26:28 UTC) #42
mmenke
https://codereview.chromium.org/2469673002/diff/160001/content/browser/loader/resource_dispatcher_host_unittest.cc File content/browser/loader/resource_dispatcher_host_unittest.cc (right): https://codereview.chromium.org/2469673002/diff/160001/content/browser/loader/resource_dispatcher_host_unittest.cc#newcode863 content/browser/loader/resource_dispatcher_host_unittest.cc:863: ~ResourceDispatcherHostTest() { override? https://codereview.chromium.org/2469673002/diff/160001/content/browser/loader/resource_message_filter_unittest.cc File content/browser/loader/resource_message_filter_unittest.cc (right): https://codereview.chromium.org/2469673002/diff/160001/content/browser/loader/resource_message_filter_unittest.cc#newcode36 content/browser/loader/resource_message_filter_unittest.cc:36: ...
4 years, 1 month ago (2016-11-09 18:34:19 UTC) #43
tzik
https://codereview.chromium.org/2469673002/diff/160001/content/browser/loader/resource_dispatcher_host_unittest.cc File content/browser/loader/resource_dispatcher_host_unittest.cc (right): https://codereview.chromium.org/2469673002/diff/160001/content/browser/loader/resource_dispatcher_host_unittest.cc#newcode863 content/browser/loader/resource_dispatcher_host_unittest.cc:863: ~ResourceDispatcherHostTest() { On 2016/11/09 18:34:19, mmenke wrote: > override? ...
4 years, 1 month ago (2016-11-10 06:08:14 UTC) #46
mmenke
Sorry for the delay - yesterday really wasn't my day. I plan to get back ...
4 years, 1 month ago (2016-11-11 16:22:59 UTC) #49
mmenke
https://codereview.chromium.org/2469673002/diff/180001/content/browser/loader/resource_message_filter_unittest.cc File content/browser/loader/resource_message_filter_unittest.cc (right): https://codereview.chromium.org/2469673002/diff/180001/content/browser/loader/resource_message_filter_unittest.cc#newcode38 content/browser/loader/resource_message_filter_unittest.cc:38: // ResourceMessageFilter here doesn't causes a crash. I'm still ...
4 years, 1 month ago (2016-11-11 19:20:52 UTC) #50
tzik
https://codereview.chromium.org/2469673002/diff/180001/content/browser/loader/resource_message_filter_unittest.cc File content/browser/loader/resource_message_filter_unittest.cc (right): https://codereview.chromium.org/2469673002/diff/180001/content/browser/loader/resource_message_filter_unittest.cc#newcode38 content/browser/loader/resource_message_filter_unittest.cc:38: // ResourceMessageFilter here doesn't causes a crash. On 2016/11/11 ...
4 years, 1 month ago (2016-11-15 09:42:40 UTC) #51
mmenke
https://codereview.chromium.org/2469673002/diff/180001/content/browser/loader/resource_message_filter_unittest.cc File content/browser/loader/resource_message_filter_unittest.cc (right): https://codereview.chromium.org/2469673002/diff/180001/content/browser/loader/resource_message_filter_unittest.cc#newcode38 content/browser/loader/resource_message_filter_unittest.cc:38: // ResourceMessageFilter here doesn't causes a crash. On 2016/11/15 ...
4 years, 1 month ago (2016-11-15 13:45:15 UTC) #52
tzik
The test is to reproduce the crash and to prove it's fixed in this CL. ...
4 years, 1 month ago (2016-11-16 11:41:42 UTC) #55
mmenke
On 2016/11/16 11:41:42, tzik wrote: > The test is to reproduce the crash and to ...
4 years, 1 month ago (2016-11-16 19:11:51 UTC) #58
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2469673002/200001
4 years, 1 month ago (2016-11-17 04:39:32 UTC) #61
commit-bot: I haz the power
Committed patchset #11 (id:200001)
4 years, 1 month ago (2016-11-17 04:47:13 UTC) #63
commit-bot: I haz the power
4 years, 1 month ago (2016-11-17 04:50:51 UTC) #65
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/5c734abad3035cfcb14b6510a152cd945146e6bd
Cr-Commit-Position: refs/heads/master@{#432746}

Powered by Google App Engine
This is Rietveld 408576698