Bug 187110 - Add nullptr check for xpc_connection_t in AuthenticationManager::initializeConnection
Summary: Add nullptr check for xpc_connection_t in AuthenticationManager::initializeCo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jiewen Tan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-27 12:20 PDT by Jiewen Tan
Modified: 2018-06-28 16:57 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.75 KB, patch)
2018-06-27 12:36 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews206 for win-future (12.82 MB, application/zip)
2018-06-27 17:14 PDT, EWS Watchlist
no flags Details
Patch (1.93 KB, patch)
2018-06-28 11:49 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch (1.93 KB, patch)
2018-06-28 11:51 PDT, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiewen Tan 2018-06-27 12:20:28 PDT
Add null check for xpc_connection_t in AuthenticationManager::initializeConnection and AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc.
Comment 1 Radar WebKit Bug Importer 2018-06-27 12:22:51 PDT
<rdar://problem/41536815>
Comment 2 Jiewen Tan 2018-06-27 12:36:20 PDT
Created attachment 343738 [details]
Patch
Comment 3 EWS Watchlist 2018-06-27 17:14:37 PDT Comment hidden (obsolete)
Comment 4 EWS Watchlist 2018-06-27 17:14:49 PDT Comment hidden (obsolete)
Comment 5 Jiewen Tan 2018-06-27 17:46:05 PDT
The tree of win EWS bot is red.
Comment 6 Anders Carlsson 2018-06-28 08:26:49 PDT
The ChangeLog doesn't explain why this change is necessary.
Comment 7 Brent Fulgham 2018-06-28 09:39:09 PDT
Comment on attachment 343738 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=343738&action=review

> Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:43
> +    if (!connection || !connection->xpcConnection()) {

I don't understand this change. It seems like you should add your nullptr check, but KEEP the XPC_TYPE_CONNECTION check. Why are you removing the XPC type check?

> Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:56
> +    if (!m_connection->xpcConnection()) {

Is the issue that sometimes we go to relay client certificate data to the network process, but the network process has been terminated?
Comment 8 Jiewen Tan 2018-06-28 11:34:31 PDT
Comment on attachment 343738 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=343738&action=review

I will add a description as well.

>> Source/WebKit/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:43
>> +    if (!connection || !connection->xpcConnection()) {
> 
> I don't understand this change. It seems like you should add your nullptr check, but KEEP the XPC_TYPE_CONNECTION check. Why are you removing the XPC type check?

I actually make a mistake last time when I added this check. What I was trying to do is to do the nullptr check. Then I discovered xpc_get_type(). Therefore I used it to do a more general check. However, xpc_get_type() doesn't do the nullptr check for its parameters... Therefore, we now crash here. Since nullptr check is what I actually need, I don't have to check the type of the object.

>> Source/WebKit/UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:56
>> +    if (!m_connection->xpcConnection()) {
> 
> Is the issue that sometimes we go to relay client certificate data to the network process, but the network process has been terminated?

I haven't observed any issues here. I added this just in case there are some future issues. I can remove this check here.
Comment 9 Jiewen Tan 2018-06-28 11:49:56 PDT
Created attachment 343825 [details]
Patch
Comment 10 Jiewen Tan 2018-06-28 11:51:45 PDT
Created attachment 343826 [details]
Patch
Comment 11 Brent Fulgham 2018-06-28 16:29:11 PDT
Comment on attachment 343826 [details]
Patch

r=me
Comment 12 Jiewen Tan 2018-06-28 16:30:37 PDT
Comment on attachment 343826 [details]
Patch

Thanks Brent for r+ this patch.
Comment 13 WebKit Commit Bot 2018-06-28 16:57:07 PDT
Comment on attachment 343826 [details]
Patch

Clearing flags on attachment: 343826

Committed r233340: <https://trac.webkit.org/changeset/233340>
Comment 14 WebKit Commit Bot 2018-06-28 16:57:09 PDT
All reviewed patches have been landed.  Closing bug.