WebKit Bugzilla
Attachment 342190 Details for
Bug 182605
: Silence MAP_JIT warning for Network Process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-182605-20180607110002.patch (text/plain), 16.29 KB, created by
Tadeu Zagallo
on 2018-06-07 11:00:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tadeu Zagallo
Created:
2018-06-07 11:00:03 PDT
Size:
16.29 KB
patch
obsolete
>Subversion Revision: 232546 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 6614868fe35d0a4581dde35291c8d7a4934c8044..854692c1c74d10426f8ec7b4150f22d0a02ca1bc 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-06-07 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Don't try to allocate JIT memory if we don't have the JIT entitlement >+ https://bugs.webkit.org/show_bug.cgi?id=182605 >+ <rdar://problem/38271229> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check that the current process has the correct entitlements before >+ trying to allocate JIT memory to silence warnings. >+ >+ * jit/ExecutableAllocator.cpp: >+ (JSC::allowJIT): Helper that checks entitlements on iOS and returns true in other platforms >+ (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator): check allowJIT before trying to allocate >+ > 2018-06-05 Brent Fulgham <bfulgham@apple.com> > > Adjust compile and runtime flags to match shippable state of features >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 05db42447c58fa0bf37e7a8e514eaff731767a85..b1fec1aba1157e68bedade7d596fb507fe3cf0f2 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,20 @@ >+2018-06-07 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Don't try to allocate JIT memory if we don't have the JIT entitlement >+ https://bugs.webkit.org/show_bug.cgi?id=182605 >+ <rdar://problem/38271229> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check that the current process has the correct entitlements before >+ trying to allocate JIT memory to silence warnings. >+ >+ * WTF.xcodeproj/project.pbxproj: >+ * wtf/PlatformMac.cmake: >+ * wtf/cocoa/Entitlements.cpp: >+ (WTF::processHasEntitlement): Moved here from Source/WebKit/Shared/mac/SandboxUtilities.mm. >+ * wtf/cocoa/Entitlements.h: Added. >+ > 2018-06-05 Darin Adler <darin@apple.com> > > [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index de5206018594b200dcbceadbd79b46ff0d89ff6e..a43bd7b4127fd79ff60322e3ed9ca19ca668394d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-07 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Don't try to allocate JIT memory if we don't have the JIT entitlement >+ https://bugs.webkit.org/show_bug.cgi?id=182605 >+ <rdar://problem/38271229> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check that the current process has the correct entitlements before >+ trying to allocate JIT memory to silence warnings. >+ >+ * Shared/mac/SandboxUtilities.mm: >+ (WebKit::processHasEntitlement): Move the implementation down to WTF to share with JavaScriptCore >+ > 2018-06-06 Jeremy Jones <jeremyj@apple.com> > > attenuationFactor should be in range [0,1] >diff --git a/Source/JavaScriptCore/jit/ExecutableAllocator.cpp b/Source/JavaScriptCore/jit/ExecutableAllocator.cpp >index 3e7e7e61fc2cdf6d52a87cf0f96e42f6675b2e0f..ef021b581857d2739f3693e28ed2cc0eaf3a34f4 100644 >--- a/Source/JavaScriptCore/jit/ExecutableAllocator.cpp >+++ b/Source/JavaScriptCore/jit/ExecutableAllocator.cpp >@@ -38,6 +38,10 @@ > #include <sys/mman.h> > #endif > >+#if PLATFORM(IOS) >+#include <wtf/cocoa/Entitlements.h> >+#endif >+ > #include "LinkBuffer.h" > #include "MacroAssembler.h" > >@@ -110,12 +114,23 @@ JS_EXPORT_PRIVATE JITWriteSeparateHeapsFunction jitWriteSeparateHeapsFunction; > static uintptr_t startOfFixedWritableMemoryPool; > #endif > >+static bool allowJIT() >+{ >+#if PLATFORM(IOS) >+ return processHasEntitlement("dynamic-codesigning"); >+#endif >+ return true; >+} >+ > class FixedVMPoolExecutableAllocator : public MetaAllocator { > WTF_MAKE_FAST_ALLOCATED; > public: > FixedVMPoolExecutableAllocator() > : MetaAllocator(jitAllocationGranule) // round up all allocations to 32 bytes > { >+ if (!allowJIT()) >+ return; >+ > size_t reservationSize; > if (Options::jitMemoryReservationSize()) > reservationSize = Options::jitMemoryReservationSize(); >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index 862c7ccbc2f08e0c6ee8ee20728156eddef7d3ff..647a9105b77cc40fd1123f0c96a16cb9053763ee 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -44,6 +44,7 @@ > 0FEC3C5E1F368A9700F59B6C /* ReadWriteLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC3C5C1F368A9700F59B6C /* ReadWriteLock.cpp */; }; > 0FFF19DC1BB334EB00886D91 /* ParallelHelperPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FFF19DA1BB334EB00886D91 /* ParallelHelperPool.cpp */; }; > 14022F4118F5C3FC007FF0EB /* libbmalloc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 14022F4018F5C3FC007FF0EB /* libbmalloc.a */; }; >+ 143DDE9620C8BC37007F76FA /* Entitlements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143DDE9520C8BC37007F76FA /* Entitlements.cpp */; }; > 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143F611D1565F0F900DB514A /* RAMSize.cpp */; }; > 1447AEC618FCE57700B3D7FF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1447AEC518FCE57700B3D7FF /* Foundation.framework */; }; > 1447AEC718FCE58000B3D7FF /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D247B6214689B8600E78B76 /* libWTF.a */; }; >@@ -268,6 +269,8 @@ > 0FFF19DB1BB334EB00886D91 /* ParallelHelperPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParallelHelperPool.h; sourceTree = "<group>"; }; > 132743924FC54E469F5A8E6E /* StdUnorderedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdUnorderedSet.h; sourceTree = "<group>"; }; > 14022F4018F5C3FC007FF0EB /* libbmalloc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libbmalloc.a; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 143DDE9520C8BC37007F76FA /* Entitlements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Entitlements.cpp; sourceTree = "<group>"; }; >+ 143DDE9720C8BE99007F76FA /* Entitlements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entitlements.h; sourceTree = "<group>"; }; > 143F611D1565F0F900DB514A /* RAMSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RAMSize.cpp; sourceTree = "<group>"; }; > 143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; }; > 1447AEBE18FCE56900B3D7FF /* libmbmalloc.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libmbmalloc.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; >@@ -1315,6 +1318,8 @@ > isa = PBXGroup; > children = ( > E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */, >+ 143DDE9520C8BC37007F76FA /* Entitlements.cpp */, >+ 143DDE9720C8BE99007F76FA /* Entitlements.h */, > 7A6EBA3320746C34004F9C44 /* MachSendRight.cpp */, > ADF2CE651E39F106006889DB /* MemoryFootprintCocoa.cpp */, > AD89B6B91E64150F0090707F /* MemoryPressureHandlerCocoa.mm */, >@@ -1465,6 +1470,7 @@ > A8A473AE151A825B004123FF /* diy-fp.cc in Sources */, > A8A473B0151A825B004123FF /* double-conversion.cc in Sources */, > A8A473BA151A825B004123FF /* dtoa.cpp in Sources */, >+ 143DDE9620C8BC37007F76FA /* Entitlements.cpp in Sources */, > A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */, > 0F7C5FB61D885CF20044F5E2 /* FastBitVector.cpp in Sources */, > A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */, >diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake >index 74b8dd906ad8aec9bfce03ce825bfee02c60e495..a26e0503e5f35e994f2c39b3991f3d8ce644b356 100644 >--- a/Source/WTF/wtf/PlatformMac.cmake >+++ b/Source/WTF/wtf/PlatformMac.cmake >@@ -10,6 +10,7 @@ list(APPEND WTF_LIBRARIES > list(APPEND WTF_PUBLIC_HEADERS > cf/TypeCastsCF.h > >+ cocoa/Entitlements.h > cocoa/MachSendRight.h > cocoa/SoftLinking.h > >@@ -43,6 +44,7 @@ list(APPEND WTF_SOURCES > text/mac/TextBreakIteratorInternalICUMac.mm > > cocoa/CPUTimeCocoa.mm >+ cocoa/Entitlements.cpp > cocoa/MachSendRight.cpp > cocoa/MemoryFootprintCocoa.cpp > cocoa/MemoryPressureHandlerCocoa.mm >diff --git a/Source/WTF/wtf/cocoa/Entitlements.cpp b/Source/WTF/wtf/cocoa/Entitlements.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..bd5c00b622d24086fa25a24bd5bf338eac851fc2 >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/Entitlements.cpp >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2018 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 "Entitlements.h" >+ >+#include <wtf/RetainPtr.h> >+#include <wtf/spi/cocoa/SecuritySPI.h> >+ >+namespace WTF { >+ >+bool processHasEntitlement(const char* entitlement) >+{ >+ auto task = adoptCF(SecTaskCreateFromSelf(CFAllocatorGetDefault())); >+ if (!task) >+ return false; >+ >+ auto cfEntitlement = adoptCF(CFStringCreateWithCString(CFAllocatorGetDefault(), entitlement, kCFStringEncodingUTF8)); >+ auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), cfEntitlement.get(), nullptr)); >+ if (!value) >+ return false; >+ >+ if (CFGetTypeID(value.get()) != CFBooleanGetTypeID()) >+ return false; >+ >+ return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); >+} >+ >+} >diff --git a/Source/WTF/wtf/cocoa/Entitlements.h b/Source/WTF/wtf/cocoa/Entitlements.h >new file mode 100644 >index 0000000000000000000000000000000000000000..831da687bdb9df3793c4381932c0a920b5a587ac >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/Entitlements.h >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#if PLATFORM(COCOA) >+ >+namespace WTF { >+ >+WTF_EXPORT bool processHasEntitlement(const char* entitlement); >+ >+} >+ >+#endif >diff --git a/Source/WebKit/Shared/mac/SandboxUtilities.mm b/Source/WebKit/Shared/mac/SandboxUtilities.mm >index d386667b9813d41bc89a67a528a76226a1e6774e..3d695f4d192ce79acc7c3ac30d65aab0a31d19c2 100644 >--- a/Source/WebKit/Shared/mac/SandboxUtilities.mm >+++ b/Source/WebKit/Shared/mac/SandboxUtilities.mm >@@ -29,7 +29,7 @@ > #import <array> > #import <sys/param.h> > #import <wtf/OSObjectPtr.h> >-#import <wtf/spi/cocoa/SecuritySPI.h> >+#import <wtf/cocoa/Entitlements.h> > #import <wtf/spi/darwin/SandboxSPI.h> > #import <wtf/spi/darwin/XPCSPI.h> > #import <wtf/text/WTFString.h> >@@ -79,18 +79,7 @@ String pathForProcessContainer() > > bool processHasEntitlement(NSString *entitlement) > { >- auto task = adoptCF(SecTaskCreateFromSelf(CFAllocatorGetDefault())); >- if (!task) >- return false; >- >- auto value = adoptCF(SecTaskCopyValueForEntitlement(task.get(), (__bridge CFStringRef)entitlement, nullptr)); >- if (!value) >- return false; >- >- if (CFGetTypeID(value.get()) != CFBooleanGetTypeID()) >- return false; >- >- return CFBooleanGetValue(static_cast<CFBooleanRef>(value.get())); >+ return WTF::processHasEntitlement(entitlement.UTF8String); > } > > bool connectedProcessHasEntitlement(xpc_connection_t connection, const char *entitlement) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 89b532a386d6e602ff1b3ca2fff9e0cc180baad4..4cb4e3f97f1fb8f6d0ede98f4d15abf2957248bf 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-06-07 Tadeu Zagallo <tzagallo@apple.com> >+ >+ Don't try to allocate JIT memory if we don't have the JIT entitlement >+ https://bugs.webkit.org/show_bug.cgi?id=182605 >+ <rdar://problem/38271229> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check that the current process has the correct entitlements before >+ trying to allocate JIT memory to silence warnings. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: iOS requires the Security framework to check entitlements >+ > 2018-06-05 Chris Dumez <cdumez@apple.com> > > Regression(r232082): Websites get loaded inside of Messages App chat transcript >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 13167a892a4bf946b80ab55a7b56a710e80919fc..590720d4920d461e979555a9d3ef10aa2da8a6fc 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -47,6 +47,7 @@ > 0F5651F71FCE4DDC00310FBC /* NoHistoryItemScrollToFragment.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F5651F61FCE4DDB00310FBC /* NoHistoryItemScrollToFragment.mm */; }; > 0F5651F91FCE513500310FBC /* scroll-to-anchor.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 0F5651F81FCE50E800310FBC /* scroll-to-anchor.html */; }; > 115EB3431EE0BA03003C2C0A /* ViewportSizeForViewportUnits.mm in Sources */ = {isa = PBXBuildFile; fileRef = 115EB3421EE0B720003C2C0A /* ViewportSizeForViewportUnits.mm */; }; >+ 143DDE9820C9018B007F76FA /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 574F55D0204D471C002948C6 /* Security.framework */; }; > 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; }; > 1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3524AC1D63A4FB0031729B /* Scope.cpp */; }; > 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4F81CD1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm */; }; >@@ -2020,6 +2021,7 @@ > buildActionMask = 2147483647; > files = ( > 93F56DA71E5F9174003EDE84 /* libicucore.dylib in Frameworks */, >+ 143DDE9820C9018B007F76FA /* Security.framework in Frameworks */, > ); > runOnlyForDeploymentPostprocessing = 0; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 182605
:
342190
|
342202
|
342206
|
342208
|
342212