Changeset 251825 in webkit


Ignore:
Timestamp:
Oct 30, 2019 5:33:49 PM (4 years ago)
Author:
pvollan@apple.com
Message:

It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known
https://bugs.webkit.org/show_bug.cgi?id=203618

Reviewed by Brent Fulgham.

Source/WebKit:

Currently, we are only able to create a mach sandbox extension for the WebContent process if we know its
audit token. It should be possible to create a mach extension without the audit token, since this is
needed when we want to create extensions before the PID or audit token is known. These extensions are
typically sent in the WebProcess creation parameters.

No new tests, this is not a behavior change, but a patch in preparation for future patches.

  • Shared/Cocoa/SandboxExtensionCocoa.mm:

(WebKit::SandboxExtensionImpl::sandboxExtensionForType):
(WebKit::SandboxExtension::createHandleForMachLookup):
(WebKit::SandboxExtension::createHandleForMachLookupByAuditToken): Deleted.

  • Shared/SandboxExtension.h:
  • UIProcess/ios/WebProcessProxyIOS.mm:

(WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):

Source/WTF:

Added SPI to create mach extension without PID or audit token.

  • wtf/spi/darwin/SandboxSPI.h:
Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r251813 r251825  
     12019-10-30  Per Arne Vollan  <pvollan@apple.com>
     2
     3        It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known
     4        https://bugs.webkit.org/show_bug.cgi?id=203618
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Added SPI to create mach extension without PID or audit token.
     9
     10        * wtf/spi/darwin/SandboxSPI.h:
     11
    1122019-10-30  Daniel Bates  <dabates@apple.com>
    213
  • trunk/Source/WTF/wtf/spi/darwin/SandboxSPI.h

    r251087 r251825  
    6767char *sandbox_extension_issue_mach_to_process(const char *extension_class, const char *name, uint32_t flags, audit_token_t);
    6868#endif
     69char *sandbox_extension_issue_mach(const char *extension_class, const char *name, uint32_t flags);
    6970int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...);
    7071int sandbox_check_by_audit_token(audit_token_t, const char *operation, enum sandbox_filter_type, ...);
  • trunk/Source/WebKit/ChangeLog

    r251824 r251825  
     12019-10-30  Per Arne Vollan  <pvollan@apple.com>
     2
     3        It should be possible to create a mach sandbox extension for the WebContent process before the audit token is known
     4        https://bugs.webkit.org/show_bug.cgi?id=203618
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Currently, we are only able to create a mach sandbox extension for the WebContent process if we know its
     9        audit token. It should be possible to create a mach extension without the audit token, since this is
     10        needed when we want to create extensions before the PID or audit token is known. These extensions are
     11        typically sent in the WebProcess creation parameters.
     12       
     13        No new tests, this is not a behavior change, but a patch in preparation for future patches.
     14
     15        * Shared/Cocoa/SandboxExtensionCocoa.mm:
     16        (WebKit::SandboxExtensionImpl::sandboxExtensionForType):
     17        (WebKit::SandboxExtension::createHandleForMachLookup):
     18        (WebKit::SandboxExtension::createHandleForMachLookupByAuditToken): Deleted.
     19        * Shared/SandboxExtension.h:
     20        * UIProcess/ios/WebProcessProxyIOS.mm:
     21        (WebKit::WebProcessProxy::unblockAccessibilityServerIfNeeded):
     22
    1232019-10-30  Per Arne Vollan  <pvollan@apple.com>
    224
  • trunk/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm

    r251087 r251825  
    9393            return sandbox_extension_issue_file(APP_SANDBOX_READ_WRITE, path, 0);
    9494        case SandboxExtension::Type::Mach:
     95            if (!auditToken)
     96                return sandbox_extension_issue_mach("com.apple.webkit.extension.mach"_s, path, 0);
    9597#if HAVE(SANDBOX_ISSUE_MACH_EXTENSION_TO_PROCESS_BY_AUDIT_TOKEN)
    96             if (!auditToken)
    97                 return nullptr;
    9898            return sandbox_extension_issue_mach_to_process("com.apple.webkit.extension.mach"_s, path, 0, *auditToken);
    9999#else
     
    337337}
    338338
    339 bool SandboxExtension::createHandleForMachLookupByAuditToken(const String& service, audit_token_t auditToken, Handle& handle)
     339bool SandboxExtension::createHandleForMachLookup(const String& service, Optional<audit_token_t> auditToken, Handle& handle)
    340340{
    341341    ASSERT(!handle.m_sandboxExtension);
  • trunk/Source/WebKit/Shared/SandboxExtension.h

    r251087 r251825  
    106106    static bool createHandleForGenericExtension(const String& extensionClass, Handle&);
    107107#if HAVE(AUDIT_TOKEN)
    108     static bool createHandleForMachLookupByAuditToken(const String& service, audit_token_t, Handle&);
     108    static bool createHandleForMachLookup(const String& service, Optional<audit_token_t>, Handle&);
    109109    static bool createHandleForReadByAuditToken(const String& path, audit_token_t, Handle&);
    110110#endif
  • trunk/Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm

    r251087 r251825  
    5555        return;
    5656
    57     ASSERT(connection() && connection()->getAuditToken());
    58     if (!connection() || !connection()->getAuditToken()) {
    59         WTFLogAlways("Unable to get audit token.");
    60         return;
    61     }
    62    
    6357    SandboxExtension::Handle handle;
    64     if (!SandboxExtension::createHandleForMachLookupByAuditToken("com.apple.iphone.axserver-systemwide", *(connection()->getAuditToken()), handle))
     58    if (!SandboxExtension::createHandleForMachLookup("com.apple.iphone.axserver-systemwide", connection() ? connection()->getAuditToken() : WTF::nullopt, handle))
    6559        return;
    6660
Note: See TracChangeset for help on using the changeset viewer.