Title: [289124] trunk/Source/WebKit
Revision
289124
Author
[email protected]
Date
2022-02-04 10:19:18 -0800 (Fri, 04 Feb 2022)

Log Message

[macOS][WP] Add telemetry for syscalls used during launch
https://bugs.webkit.org/show_bug.cgi?id=235865
<rdar://problem/88228583>

Reviewed by Brent Fulgham.

Add telemetry in the WebContent process' sandbox on macOS to determine which syscalls are used only during launch.

* WebProcess/com.apple.WebProcess.sb.in:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (289123 => 289124)


--- trunk/Source/WebKit/ChangeLog	2022-02-04 18:17:30 UTC (rev 289123)
+++ trunk/Source/WebKit/ChangeLog	2022-02-04 18:19:18 UTC (rev 289124)
@@ -1,5 +1,17 @@
 2022-02-04  Per Arne Vollan  <[email protected]>
 
+        [macOS][WP] Add telemetry for syscalls used during launch
+        https://bugs.webkit.org/show_bug.cgi?id=235865
+        <rdar://problem/88228583>
+
+        Reviewed by Brent Fulgham.
+
+        Add telemetry in the WebContent process' sandbox on macOS to determine which syscalls are used only during launch.
+
+        * WebProcess/com.apple.WebProcess.sb.in:
+
+2022-02-04  Per Arne Vollan  <[email protected]>
+
         [iOS][macOS] Adjust sysctl sandbox access
         https://bugs.webkit.org/show_bug.cgi?id=236082
         <rdar://problem/88436174>

Modified: trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in (289123 => 289124)


--- trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2022-02-04 18:17:30 UTC (rev 289123)
+++ trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2022-02-04 18:19:18 UTC (rev 289124)
@@ -1894,8 +1894,25 @@
 (disable-syscall-inference)
 #endif
 
-(define (syscall-unix-common)
+#if HAVE(SANDBOX_STATE_FLAGS)
+(deny user-preference-read (with enable-state-flag "WebContentProcessLaunched")
+    (preference-domain "com.apple.WebKit.WebContent.Launch"))
+#endif
+
+(define (syscall-unix-only-in-use-during-launch)
     (syscall-number
+        SYS_csops
+        SYS_csrctl
+        SYS_fsgetpath
+        SYS_getaudit_addr
+        SYS_getfsstat64
+        SYS_getrlimit
+        SYS_kdebug_trace
+        SYS_pathconf
+        SYS_statfs64))
+
+(define (syscall-unix-in-use-after-launch)
+    (syscall-number
         SYS___disable_threadsignal
         SYS___mac_syscall
         SYS___pthread_sigmask
@@ -1906,9 +1923,7 @@
         SYS_bsdthread_terminate
         SYS_close
         SYS_close_nocancel
-        SYS_csops
         SYS_csops_audittoken
-        SYS_csrctl
         SYS_exit
         SYS_faccessat ;; <rdar://problem/56690456>
         SYS_fcntl
@@ -1917,7 +1932,6 @@
         SYS_fileport_makefd
         SYS_flock
         SYS_fsetxattr ;; <rdar://problem/56332491>
-        SYS_fsgetpath
         SYS_fstat64
         SYS_fstatat64
         SYS_fstatfs64
@@ -1924,14 +1938,11 @@
         SYS_ftruncate
         SYS_getattrlist
         SYS_getattrlistbulk
-        SYS_getaudit_addr
         SYS_getdirentries64
         SYS_getentropy
         SYS_geteuid
-        SYS_getfsstat64
         SYS_getgid
         SYS_gethostuuid
-        SYS_getrlimit
         SYS_getrusage
         SYS_gettimeofday
         SYS_getuid
@@ -1938,7 +1949,6 @@
         SYS_getxattr
         SYS_ioctl
         SYS_issetugid
-        SYS_kdebug_trace
         SYS_kdebug_trace64
         SYS_kdebug_trace_string ;; Needed for performance sampling, see <rdar://problem/48829655>.
         SYS_kevent_id
@@ -1961,7 +1971,6 @@
         SYS_open
         SYS_open_nocancel
         SYS_openat
-        SYS_pathconf
         SYS_pread
         SYS_proc_info
         SYS_psynch_cvbroad
@@ -1979,9 +1988,8 @@
         SYS_sendto
         SYS_sigaltstack
         SYS_sigprocmask
+        SYS_socket
         SYS_stat64
-        SYS_statfs64
-        SYS_socket
         SYS_sysctlbyname
         SYS_thread_selfid
 #if !PLATFORM(MAC)
@@ -2044,14 +2052,31 @@
 ))
 
 (when (defined? 'syscall-unix)
-    (deny syscall-unix (with send-signal SIGKILL))
+    (deny syscall-unix (with telemetry)(with send-signal SIGKILL))
+
+#if HAVE(SANDBOX_STATE_FLAGS)
+    (with-filter (require-not (state-flag "WebContentProcessLaunched"))
+        (allow syscall-unix
+            (syscall-unix-in-use-after-launch))
+        (allow syscall-unix
+            (syscall-unix-only-in-use-during-launch)))
+    (with-filter (state-flag "WebContentProcessLaunched")
+        (allow syscall-unix
+            (syscall-unix-in-use-after-launch))
+        (allow syscall-unix
+            (with report)
+            (with telemetry)
+            (with message "Unix syscall used after launch")
+            (syscall-unix-only-in-use-during-launch)))
+#else
     (allow syscall-unix
-        (syscall-unix-common))
+        (syscall-unix-only-in-use-during-launch)
+        (syscall-unix-in-use-after-launch))
+#endif
 
-    (if (equal? (param "CPU") "arm64")
-        (begin
+    (when (equal? (param "CPU") "arm64")
             (allow syscall-unix
-                (syscall-unix-apple-silicon))))
+                (syscall-unix-apple-silicon)))
 
     (allow syscall-unix
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to