DescriptionEliminate a potential race in IPC::ChannelProxy
Doing the following steps with ChannelProxy leads to a data race:
1) Create the ChannelProxy, but don't initialize it.
2) Add a filter.
3) Init the ChannelProxy.
The problem is, AddFilter() posts a task from the Listener thread to the IPC task runner to do OnAddFilter. Prior to this patch, OnAddFilter will try to read channel_ even though channel_ may not have been initialized, and it's accessed without any synchronization.
This patch only really adds the filter if peer_pid_ has been set on the IPC::Channel thread; otherwise, it waits until the connection has been established to really add filters.
See the bug for more detail.
BUG=244383
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=256188
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=258406
Patch Set 1 #
Total comments: 1
Patch Set 2 : Review comments, fix OnRemoveFilter #Patch Set 3 : Call OnChannelConnected only once. #Patch Set 4 : Remove unrelated appcache change #Patch Set 5 : Clarify comment. #
Total comments: 3
Patch Set 6 : Make ipc_channel_nacl call OnChannelConnected #Patch Set 7 : PostTask OnChannelConnected; put back in call to OnChannelClosed for SyncChannel #Patch Set 8 : merge and try CQ again #Patch Set 9 : Merge #Patch Set 10 : Clear pending_filters_ on the IO thread if the channel is closed. #Patch Set 11 : merge #
Messages
Total messages: 30 (0 generated)
|