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

Issue 2143003003: Delay client registration of MessagePort to MessagePortChannel (Closed)

Created:
4 years, 5 months ago by tzik
Modified:
4 years, 5 months ago
Reviewers:
haraken, yhirano
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Delay client registration of MessagePort to MessagePortChannel MessagePort used to be registered to MessagePortChannel on entangle(), and be unregisted when the ExecutionContext is stopped or MessagePort is swept by GC. Once its start() is called, its hasPendingActivity() will be true and that extends the MessagePort lifetime to stop() or close() call. However, there's a time gap between the MessagePort instance is marked as unreachable, and swept by GC system. If MessagePortChannel accesses the MessagePort in this period, that causes use-after-poison crash. I.e. there are two pattern of the life of MessagePort. 1. entangle() + register -> gets unreachable -(poisoned period)-> swept + unregister 2. entangle() + register -> start() -> stop() + unregister 3. entangle() + register -> start() -> close() + unregister (2) and (3) cases are OK, while (1) has a dangerous period. This CL delays the registration from entangle() to start(), so that the case (1) doesn't register the MessagePort to MessagePortChannel at all. BUG=627457 Committed: https://crrev.com/f7dbf39be31d8aa9214d5d84da613508d4e06491 Cr-Commit-Position: refs/heads/master@{#405450}

Patch Set 1 #

Total comments: 2

Patch Set 2 : s/close()/DCHECK/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -4 lines) Patch
M third_party/WebKit/Source/core/dom/MessagePort.cpp View 1 5 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 18 (10 generated)
tzik
PTAL
4 years, 5 months ago (2016-07-14 03:15:46 UTC) #2
haraken
LGTM
4 years, 5 months ago (2016-07-14 03:43:46 UTC) #3
yhirano
lgtm description: there is one another path to close the message port: close function exposed ...
4 years, 5 months ago (2016-07-14 04:30:23 UTC) #4
tzik
https://codereview.chromium.org/2143003003/diff/1/third_party/WebKit/Source/core/dom/MessagePort.cpp File third_party/WebKit/Source/core/dom/MessagePort.cpp (right): https://codereview.chromium.org/2143003003/diff/1/third_party/WebKit/Source/core/dom/MessagePort.cpp#newcode65 third_party/WebKit/Source/core/dom/MessagePort.cpp:65: close(); On 2016/07/14 04:30:22, yhirano wrote: > DCHECK(!started() || ...
4 years, 5 months ago (2016-07-14 04:59:57 UTC) #7
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/2143003003/20001
4 years, 5 months ago (2016-07-14 07:10:38 UTC) #13
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 5 months ago (2016-07-14 08:24:09 UTC) #15
commit-bot: I haz the power
CQ bit was unchecked.
4 years, 5 months ago (2016-07-14 08:24:15 UTC) #16
commit-bot: I haz the power
4 years, 5 months ago (2016-07-14 08:25:35 UTC) #18
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/f7dbf39be31d8aa9214d5d84da613508d4e06491
Cr-Commit-Position: refs/heads/master@{#405450}

Powered by Google App Engine
This is Rietveld 408576698