Diff
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog 2019-02-20 12:43:30 UTC (rev 241795)
@@ -1,3 +1,23 @@
+2019-02-18 Tadeu Zagallo <[email protected]>
+
+ 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.
+
+ 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):
+
2019-02-16 Yusuke Suzuki <[email protected]>
[JSC] JSWrapperObject should not be destructible
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/CachedTypes.cpp (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/CachedTypes.cpp 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/CachedTypes.cpp 2019-02-20 12:43:30 UTC (rev 241795)
@@ -41,6 +41,7 @@
#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
#include <wtf/Optional.h>
+#include <wtf/UUID.h>
#include <wtf/text/AtomicStringImpl.h>
namespace JSC {
@@ -102,10 +103,10 @@
return malloc(size);
}
- template<typename T>
- T* malloc()
+ template<typename T, typename... Args>
+ T* malloc(Args&&... args)
{
- return new (malloc(sizeof(T)).buffer()) T();
+ return new (malloc(sizeof(T)).buffer()) T(std::forward<Args>(args)...);
}
ptrdiff_t offsetOf(const void* address)
@@ -1990,12 +1991,17 @@
bool decode(Decoder&, std::pair<SourceCodeKey, UnlinkedCodeBlock*>&) const;
protected:
- GenericCacheEntry(CachedCodeBlockTag tag)
+ GenericCacheEntry(Encoder& encoder, CachedCodeBlockTag tag)
: m_tag(tag)
{
+ m_bootSessionUUID.encode(encoder, bootSessionUUIDString());
}
+ CachedCodeBlockTag tag() const { return m_tag; }
+
+private:
uint32_t m_cacheVersion { JSC_BYTECODE_CACHE_VERSION };
+ CachedString m_bootSessionUUID;
CachedCodeBlockTag m_tag;
};
@@ -2002,8 +2008,8 @@
template<typename UnlinkedCodeBlockType>
class CacheEntry : public GenericCacheEntry {
public:
- CacheEntry()
- : GenericCacheEntry(CachedCodeBlockTypeImpl<UnlinkedCodeBlockType>::tag)
+ CacheEntry(Encoder& encoder)
+ : GenericCacheEntry(encoder, CachedCodeBlockTypeImpl<UnlinkedCodeBlockType>::tag)
{
}
@@ -2018,11 +2024,7 @@
bool decode(Decoder& decoder, std::pair<SourceCodeKey, UnlinkedCodeBlockType*>& result) const
{
- if (m_cacheVersion != JSC_BYTECODE_CACHE_VERSION)
- return false;
- ASSERT(m_tag == CachedCodeBlockTypeImpl<UnlinkedCodeBlockType>::tag);
- if (m_tag != CachedCodeBlockTypeImpl<UnlinkedCodeBlockType>::tag)
- return false;
+ ASSERT(tag() == CachedCodeBlockTypeImpl<UnlinkedCodeBlockType>::tag);
SourceCodeKey decodedKey;
m_key.decode(decoder, decodedKey);
result = { WTFMove(decodedKey), m_codeBlock.decode(decoder) };
@@ -2035,6 +2037,11 @@
bool GenericCacheEntry::decode(Decoder& decoder, std::pair<SourceCodeKey, UnlinkedCodeBlock*>& result) const
{
+ if (m_cacheVersion != JSC_BYTECODE_CACHE_VERSION)
+ return false;
+ if (m_bootSessionUUID.decode(decoder) != bootSessionUUIDString())
+ return false;
+
switch (m_tag) {
case CachedProgramCodeBlockTag:
return reinterpret_cast<const CacheEntry<UnlinkedProgramCodeBlock>*>(this)->decode(decoder, reinterpret_cast<std::pair<SourceCodeKey, UnlinkedProgramCodeBlock*>&>(result));
@@ -2054,7 +2061,7 @@
template<typename UnlinkedCodeBlockType>
void encodeCodeBlock(Encoder& encoder, const SourceCodeKey& key, const UnlinkedCodeBlock* codeBlock)
{
- auto* entry = encoder.template malloc<CacheEntry<UnlinkedCodeBlockType>>();
+ auto* entry = encoder.template malloc<CacheEntry<UnlinkedCodeBlockType>>(encoder);
entry->encode(encoder, { key, jsCast<const UnlinkedCodeBlockType*>(codeBlock) });
}
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/ChangeLog 2019-02-20 12:43:30 UTC (rev 241795)
@@ -1,3 +1,17 @@
+2019-02-18 Tadeu Zagallo <[email protected]>
+
+ 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.
+
+ Add helper to get kern.bootsessionuuid from sysctl
+
+ * wtf/UUID.cpp:
+ (WTF::bootSessionUUIDString):
+ * wtf/UUID.h:
+
2019-02-15 Dominik Infuehr <[email protected]>
Fix deadlock on Linux/x64 between SamplingProfiler and VMTraps
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/UUID.cpp (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/UUID.cpp 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/UUID.cpp 2019-02-20 12:43:30 UTC (rev 241795)
@@ -31,10 +31,15 @@
#include "config.h"
#include <wtf/UUID.h>
+#include <mutex>
#include <wtf/CryptographicallyRandomNumber.h>
#include <wtf/HexNumber.h>
#include <wtf/text/StringBuilder.h>
+#if OS(DARWIN)
+#include <sys/sysctl.h>
+#endif
+
namespace WTF {
String createCanonicalUUIDString()
@@ -59,4 +64,20 @@
return builder.toString();
}
+String bootSessionUUIDString()
+{
+ static LazyNeverDestroyed<String> bootSessionUUID;
+#if OS(DARWIN)
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [] {
+ size_t uuidLength = 37;
+ char uuid[uuidLength];
+ if (sysctlbyname("kern.bootsessionuuid", uuid, &uuidLength, nullptr, 0))
+ return;
+ bootSessionUUID.construct(static_cast<const char*>(uuid), uuidLength - 1);
+ });
+#endif
+ return bootSessionUUID;
+}
+
} // namespace WTF
Modified: releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/UUID.h (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/UUID.h 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Source/WTF/wtf/UUID.h 2019-02-20 12:43:30 UTC (rev 241795)
@@ -45,6 +45,9 @@
WTF_EXPORT_PRIVATE String createCanonicalUUIDString();
+WTF_EXPORT_PRIVATE String bootSessionUUIDString();
+
}
using WTF::createCanonicalUUIDString;
+using WTF::bootSessionUUIDString;
Modified: releases/WebKitGTK/webkit-2.24/Tools/ChangeLog (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Tools/ChangeLog 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Tools/ChangeLog 2019-02-20 12:43:30 UTC (rev 241795)
@@ -1,3 +1,17 @@
+2019-02-18 Tadeu Zagallo <[email protected]>
+
+ 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.
+
+ Add test for WTF::bootSessionUUIDString()
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WTF/UUID.cpp: Added.
+ (TEST):
+
2019-02-16 Zalan Bujtas <[email protected]>
[LFC] Apply min/max width constraints to preferred width computation
Modified: releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (241794 => 241795)
--- releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-02-20 12:43:23 UTC (rev 241794)
+++ releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-02-20 12:43:30 UTC (rev 241795)
@@ -1352,6 +1352,7 @@
11B7FD22219F46DD0069B27F /* FirstMeaningfulPaintMilestone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FirstMeaningfulPaintMilestone.cpp; sourceTree = "<group>"; };
11C2598C21FA618D004C9E23 /* async-script-load.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "async-script-load.html"; sourceTree = "<group>"; };
14464012167A8305000BD218 /* LayoutUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnit.cpp; sourceTree = "<group>"; };
+ 144D40EC221B46A7004B474F /* UUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UUID.cpp; sourceTree = "<group>"; };
14F3B11215E45EAB00210069 /* SaturatedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SaturatedArithmeticOperations.cpp; sourceTree = "<group>"; };
1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = "<group>"; };
1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = "<group>"; };
@@ -3292,6 +3293,7 @@
5C5E633D1D0B67940085A025 /* UniqueRef.cpp */,
E3A1E78021B25B79008C6007 /* URL.cpp */,
E3A1E78421B25B91008C6007 /* URLParser.cpp */,
+ 144D40EC221B46A7004B474F /* UUID.cpp */,
7CD0D5AA1D5534DE000CC9E1 /* Variant.cpp */,
BC55F5F814AD78EE00484BE1 /* Vector.cpp */,
1CB9BC371A67482300FE5678 /* WeakPtr.cpp */,
Added: releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/Tests/WTF/UUID.cpp (0 => 241795)
--- releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/Tests/WTF/UUID.cpp (rev 0)
+++ releases/WebKitGTK/webkit-2.24/Tools/TestWebKitAPI/Tests/WTF/UUID.cpp 2019-02-20 12:43:30 UTC (rev 241795)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include <wtf/UUID.h>
+
+TEST(WTF, BootSessionUUIDIdentity)
+{
+ EXPECT_EQ(bootSessionUUIDString(), bootSessionUUIDString());
+}