RESOLVED FIXED 194189
Validate navigation policy decisions to avoid crashes in continueLoadAfterNavigationPolicy
https://bugs.webkit.org/show_bug.cgi?id=194189
Summary Validate navigation policy decisions to avoid crashes in continueLoadAfterNav...
Ryosuke Niwa
Reported 2019-02-02 00:33:07 PST
We're hitting crashes in FrameLoader::continueLoadAfterNavigationPolicy where isBackForwardLoadType would return true yet history().provisionalItem() is null. We think this is because we're mixing up one policy decision requests / responses for different navigations. Add identifiers for each policy decision in WebCore as done in WebKit2. <rdar://problem/22872341>
Attachments
Adds the validation (94.67 KB, patch)
2019-02-02 00:56 PST, Ryosuke Niwa
no flags
Updated for trunk (92.82 KB, patch)
2019-02-02 01:26 PST, Ryosuke Niwa
no flags
Patch for landing (102.86 KB, patch)
2019-02-02 20:06 PST, Ryosuke Niwa
no flags
Another windows build fix attempt (102.88 KB, patch)
2019-02-02 21:03 PST, Ryosuke Niwa
no flags
Fixed Windows build (103.17 KB, patch)
2019-02-02 22:04 PST, Ryosuke Niwa
no flags
Ryosuke Niwa
Comment 1 2019-02-02 00:56:32 PST
Created attachment 360967 [details] Adds the validation
Ryosuke Niwa
Comment 2 2019-02-02 01:26:45 PST
Created attachment 360970 [details] Updated for trunk
EWS Watchlist
Comment 3 2019-02-02 01:29:47 PST
Attachment 360970 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:763: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:910: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:923: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/loader/EmptyFrameLoaderClient.h:96: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] ERROR: Source/WebCore/loader/PolicyChecker.cpp:193: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:877: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:909: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:921: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/loader/DocumentLoader.cpp:59: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 9 in 26 files If any of these errors are false positives, please file a bug against check-webkit-style.
Geoffrey Garen
Comment 4 2019-02-02 12:44:47 PST
Seems like a real build failure: C:\cygwin\home\buildbot\WebKit\Source\WebKitLegacy\win\WebCoreSupport\WebFrameLoaderClient.h(103): error C3668: 'WebFrameLoaderClient::dispatchDecidePolicyForResponse': method with override specifier 'override' did not override any base class methods (compiling source file C:\cygwin\home\buildbot\WebKit\Source\WebKitLegacy\win\Plugins\PluginView.cpp) [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Source\WebKitLegacy\WebKitLegacy.vcxproj]
Geoffrey Garen
Comment 5 2019-02-02 12:52:32 PST
Comment on attachment 360970 [details] Updated for trunk View in context: https://bugs.webkit.org/attachment.cgi?id=360970&action=review r=me, please fix the Windows build > Source/WebCore/loader/FrameLoaderTypes.h:72 > + PolicyCheckIdentifier() = default; Is it valid to construct a null PolicyCheckIdentifier? Is it necessary? Maybe we should = delete this. > Source/WebCore/loader/FrameLoaderTypes.h:75 > + static PolicyCheckIdentifier generate(); I think we usually call this function "create". > Source/WebCore/loader/FrameLoaderTypes.h:89 > + uint64_t m_check { 0 }; I would call this m_policyCheck. > Source/WebCore/loader/PolicyChecker.cpp:84 > + RELEASE_ASSERT_WITH_MESSAGE(m_check, "Received a non-generated policy check identifier"); Maybe call this a null policy check identifier? Not clear what "non-generated" means, and in theory some non-generated values might be non-zero.
Ryosuke Niwa
Comment 6 2019-02-02 17:23:34 PST
(In reply to Geoffrey Garen from comment #5) > Comment on attachment 360970 [details] > Updated for trunk > > View in context: > https://bugs.webkit.org/attachment.cgi?id=360970&action=review > > r=me, please fix the Windows build will do. > > Source/WebCore/loader/FrameLoaderTypes.h:72 > > + PolicyCheckIdentifier() = default; > > Is it valid to construct a null PolicyCheckIdentifier? Is it necessary? > Maybe we should = delete this. Unfortunately we need this in a few places like argument encoders and WebFrame in WebKit2 where we have it as a member. > > Source/WebCore/loader/FrameLoaderTypes.h:75 > > + static PolicyCheckIdentifier generate(); > > I think we usually call this function "create". Sure, will rename. > > Source/WebCore/loader/FrameLoaderTypes.h:89 > > + uint64_t m_check { 0 }; > > I would call this m_policyCheck. Will do. > > Source/WebCore/loader/PolicyChecker.cpp:84 > > + RELEASE_ASSERT_WITH_MESSAGE(m_check, "Received a non-generated policy check identifier"); > > Maybe call this a null policy check identifier? Not clear what > "non-generated" means, and in theory some non-generated values might be > non-zero. Sure, will do.
Ryosuke Niwa
Comment 7 2019-02-02 20:06:56 PST
Created attachment 360993 [details] Patch for landing
Ryosuke Niwa
Comment 8 2019-02-02 20:10:07 PST
Comment on attachment 360993 [details] Patch for landing Wait for EWS.
EWS Watchlist
Comment 9 2019-02-02 20:11:33 PST
Attachment 360993 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:763: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:910: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:923: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/loader/EmptyFrameLoaderClient.h:96: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] ERROR: Source/WebCore/loader/PolicyChecker.cpp:193: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp:627: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:877: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:909: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:921: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/loader/DocumentLoader.cpp:59: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 10 in 29 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 10 2019-02-02 21:03:50 PST
Created attachment 360997 [details] Another windows build fix attempt
EWS Watchlist
Comment 11 2019-02-02 21:05:31 PST
Attachment 360997 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:763: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:910: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:923: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/loader/EmptyFrameLoaderClient.h:96: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] ERROR: Source/WebCore/loader/PolicyChecker.cpp:193: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp:627: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:877: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:909: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:921: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/loader/DocumentLoader.cpp:59: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 10 in 29 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 12 2019-02-02 22:04:17 PST
Created attachment 360998 [details] Fixed Windows build
EWS Watchlist
Comment 13 2019-02-02 22:06:12 PST
Attachment 360998 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:763: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:910: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:923: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebCore/loader/EmptyFrameLoaderClient.h:96: Inline functions should not be in classes annotated with WEBCORE_EXPORT. Remove the macro from the class and apply it to each appropriate method, or move the inline function definition out-of-line. [build/webcore_export] [4] ERROR: Source/WebCore/loader/PolicyChecker.cpp:193: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/win/WebCoreSupport/WebFrameLoaderClient.cpp:627: Multi line control clauses should use braces. [whitespace/braces] [4] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:877: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:909: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:921: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/loader/DocumentLoader.cpp:59: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 10 in 29 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 14 2019-02-03 14:48:28 PST
Comment on attachment 360998 [details] Fixed Windows build Clearing flags on attachment: 360998 Committed r240909: <https://trac.webkit.org/changeset/240909>
WebKit Commit Bot
Comment 15 2019-02-03 14:48:30 PST
All reviewed patches have been landed. Closing bug.
Alex Christensen
Comment 16 2019-02-19 11:38:58 PST
Comment on attachment 360998 [details] Fixed Windows build View in context: https://bugs.webkit.org/attachment.cgi?id=360998&action=review > Source/WebCore/loader/PolicyChecker.cpp:196 > + if (!responseIdentifier.isValidFor(requestIdentifier)) > + return; Why do we not call function in this case? > Source/WebCore/loader/PolicyChecker.cpp:237 > + if (!responseIdentifier.isValidFor(requestIdentifier)) > + return; Ditto. These could cause hangs.
Alex Christensen
Comment 17 2019-02-19 11:41:10 PST
Note You need to log in before you can comment on or make changes to this bug.