Bytecode cache should a have a boot-specific validation
authortzagallo@apple.com <tzagallo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2019 20:55:45 +0000 (20:55 +0000)
committertzagallo@apple.com <tzagallo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2019 20:55:45 +0000 (20:55 +0000)
commit7cd3e76dfd6eb1c8c58cb95278000279129fe767
tree04ea8bb3ed730d7ece1967983d4cf1703b00b485
parentf94c5d78d3433cfefb1b9bd02f49a49bf5887103
Bytecode cache should a have a boot-specific validation
https://bugs.webkit.org/show_bug.cgi?id=194769
<rdar://problem/48149509>

Reviewed by Keith Miller.

Source/JavaScriptCore:

Add the boot UUID to the cached bytecode to enforce that it is not reused
across reboots.

* runtime/CachedTypes.cpp:
(JSC::Encoder::malloc):
(JSC::GenericCacheEntry::GenericCacheEntry):
(JSC::GenericCacheEntry::tag const):
(JSC::CacheEntry::CacheEntry):
(JSC::CacheEntry::decode const):
(JSC::GenericCacheEntry::decode const):
(JSC::encodeCodeBlock):

Source/WTF:

Add helper to get kern.bootsessionuuid from sysctl

* wtf/UUID.cpp:
(WTF::bootSessionUUIDString):
* wtf/UUID.h:

Tools:

Add test for WTF::bootSessionUUIDString()

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/UUID.cpp: Added.
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241733 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/CachedTypes.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/UUID.cpp
Source/WTF/wtf/UUID.h
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WTF/UUID.cpp [new file with mode: 0644]