RESOLVED FIXED 194769
Bytecode cache should a have a boot-specific validation
https://bugs.webkit.org/show_bug.cgi?id=194769
Summary Bytecode cache should a have a boot-specific validation
Tadeu Zagallo
Reported 2019-02-18 00:49:47 PST
...
Attachments
Patch (4.44 KB, patch)
2019-02-18 00:57 PST, Tadeu Zagallo
no flags
Patch (4.43 KB, patch)
2019-02-18 02:36 PST, Tadeu Zagallo
no flags
Archive of layout-test-results from ews113 for mac-highsierra (2.09 MB, application/zip)
2019-02-18 04:19 PST, EWS Watchlist
no flags
Patch (6.63 KB, patch)
2019-02-18 11:38 PST, Tadeu Zagallo
no flags
Patch for landing (11.30 KB, patch)
2019-02-18 12:11 PST, Tadeu Zagallo
no flags
Tadeu Zagallo
Comment 1 2019-02-18 00:50:13 PST
Tadeu Zagallo
Comment 2 2019-02-18 00:57:48 PST
Tadeu Zagallo
Comment 3 2019-02-18 02:36:40 PST
Created attachment 362278 [details] Patch Rebase
EWS Watchlist
Comment 4 2019-02-18 04:19:45 PST
Comment on attachment 362278 [details] Patch Attachment 362278 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/11190412 New failing tests: webgl/2.0.0/conformance/context/context-release-upon-reload.html
EWS Watchlist
Comment 5 2019-02-18 04:19:46 PST
Created attachment 362289 [details] Archive of layout-test-results from ews113 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-highsierra Platform: Mac OS X 10.13.6
Keith Miller
Comment 6 2019-02-18 10:45:49 PST
Comment on attachment 362278 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362278&action=review > Source/JavaScriptCore/runtime/CachedTypes.cpp:78 > +using UUID = std::array<uint8_t, 16>; > + > +static UUID bootUUID() > +{ > + static UUID bootUUID = { }; > +#if OS(DARWIN) > + static std::once_flag onceKey; > + std::call_once(onceKey, [] { > + size_t uuidlen = 37; > + char uuid[uuidlen]; > + if (sysctlbyname("kern.bootsessionuuid", uuid, &uuidlen, nullptr, 0)) > + return; > + uint32_t offset = 0; > + for (uint32_t i = 0; i < uuidlen - 1;) { > + if (uuid[i] == '-') { > + ++i; > + continue; > + } > + bootUUID[offset++] = toASCIIHexValue(uuid[i], uuid[i+1]); > + i += 2; > + } > + RELEASE_ASSERT(offset == sizeof(UUID)); > + }); > +#endif > + return bootUUID; > +} Can we move this to its own file in WTF? Maybe UUID.h? If we do that though, we might just want to make the UUID a string or make it a class that has an operator String&()
Tadeu Zagallo
Comment 7 2019-02-18 11:38:02 PST
EWS Watchlist
Comment 8 2019-02-18 11:40:19 PST
Attachment 362308 [details] did not pass style-queue: ERROR: Source/WTF/wtf/UUID.cpp:34: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Keith Miller
Comment 9 2019-02-18 11:42:34 PST
Comment on attachment 362308 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362308&action=review r=me with small fix. > Source/WTF/wtf/UUID.cpp:34 > +#include <mutex> I think you need to move this to after the WTF includes.
Saam Barati
Comment 10 2019-02-18 11:54:57 PST
Comment on attachment 362308 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362308&action=review > Source/WTF/wtf/UUID.cpp:77 > + bootSessionUUID.construct(String(uuid, 36)); Nit: I think you can just invoke the normal constructor instead of the move constructor: construct(uuid, 36) I’d also say uuidLength - 1 instead of 36.
Tadeu Zagallo
Comment 11 2019-02-18 11:58:16 PST
Comment on attachment 362308 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362308&action=review >> Source/WTF/wtf/UUID.cpp:77 >> + bootSessionUUID.construct(String(uuid, 36)); > > Nit: I think you can just invoke the normal constructor instead of the move constructor: construct(uuid, 36) > > I’d also say uuidLength - 1 instead of 36. I tried that, but it complained about the char[] as a template argument. I thought this was better than casting, but I'm happy to change it. I'll change the length argument.
Tadeu Zagallo
Comment 12 2019-02-18 12:11:54 PST
Created attachment 362310 [details] Patch for landing
EWS Watchlist
Comment 13 2019-02-18 12:15:17 PST
Attachment 362310 [details] did not pass style-queue: ERROR: Source/WTF/wtf/UUID.cpp:34: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 14 2019-02-18 12:25:24 PST
Comment on attachment 362310 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=362310&action=review > Source/JavaScriptCore/ChangeLog:10 > + Add the boot UUID to the cached bytecode to enforce that it is not reused > + across reboots. What is the reason for invalidating across reboots? What bug are you trying to fix/avoid?
Keith Miller
Comment 15 2019-02-18 12:40:39 PST
(In reply to Sam Weinig from comment #14) > Comment on attachment 362310 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=362310&action=review > > > Source/JavaScriptCore/ChangeLog:10 > > + Add the boot UUID to the cached bytecode to enforce that it is not reused > > + across reboots. > > What is the reason for invalidating across reboots? What bug are you trying > to fix/avoid? It’s to prevent a malicious bytecode cache from pwning the device across reboots.
WebKit Commit Bot
Comment 16 2019-02-18 12:55:51 PST
Comment on attachment 362310 [details] Patch for landing Clearing flags on attachment: 362310 Committed r241733: <https://trac.webkit.org/changeset/241733>
WebKit Commit Bot
Comment 17 2019-02-18 12:55:52 PST
All reviewed patches have been landed. Closing bug.
Sam Weinig
Comment 18 2019-02-18 13:06:47 PST
(In reply to Keith Miller from comment #15) > (In reply to Sam Weinig from comment #14) > > Comment on attachment 362310 [details] > > Patch for landing > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=362310&action=review > > > > > Source/JavaScriptCore/ChangeLog:10 > > > + Add the boot UUID to the cached bytecode to enforce that it is not reused > > > + across reboots. > > > > What is the reason for invalidating across reboots? What bug are you trying > > to fix/avoid? > > It’s to prevent a malicious bytecode cache from pwning the device across > reboots. Please try and include the "why" in the ChangeLog.
Keith Miller
Comment 19 2019-02-18 14:53:47 PST
> > Please try and include the "why" in the ChangeLog. Fair enough.
Note You need to log in before you can comment on or make changes to this bug.