<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>200182</bug_id>
          
          <creation_ts>2019-07-26 16:27:10 -0700</creation_ts>
          <short_desc>Allow more syscalls in the WebContent process&apos; sandbox profile</short_desc>
          <delta_ts>2019-07-27 06:41:59 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>commit-queue</cc>
    
    <cc>ggaren</cc>
    
    <cc>pvollan</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1556269</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-07-26 16:27:10 -0700</bug_when>
    <thetext>Allow more syscalls in the WebContent process&apos; sandbox profile to avoid getting killed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556270</commentid>
    <comment_count>1</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-07-26 16:27:25 -0700</bug_when>
    <thetext>&lt;rdar://problem/53594973&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556271</commentid>
    <comment_count>2</comment_count>
      <attachid>374998</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-07-26 16:28:52 -0700</bug_when>
    <thetext>Created attachment 374998
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556273</commentid>
    <comment_count>3</comment_count>
      <attachid>374998</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-07-26 16:33:55 -0700</bug_when>
    <thetext>Comment on attachment 374998
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=374998&amp;action=review

&gt; Source/WebKit/WebProcess/com.apple.WebProcess.sb.in:945
&gt; +        (syscall-number SYS_recvmsg)

This one looks suspicious. Looking at the logs, it seems like there is actual networking happening in WebContent, which is not allowed. So we may need a higher level fix here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556274</commentid>
    <comment_count>4</comment_count>
      <attachid>374998</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-07-26 16:36:50 -0700</bug_when>
    <thetext>Comment on attachment 374998
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=374998&amp;action=review

&gt;&gt; Source/WebKit/WebProcess/com.apple.WebProcess.sb.in:945
&gt;&gt; +        (syscall-number SYS_recvmsg)
&gt; 
&gt; This one looks suspicious. Looking at the logs, it seems like there is actual networking happening in WebContent, which is not allowed. So we may need a higher level fix here.

I am no sandboxing expert so I followed the existing pattern. We already allow SYS_recvfrom / SYS_recvfrom_nocancel / SYS_sendto / SYS_sendmsg_nocancel / SYS_sendto_nocancel.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556275</commentid>
    <comment_count>5</comment_count>
      <attachid>374998</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-07-26 16:37:48 -0700</bug_when>
    <thetext>Comment on attachment 374998
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=374998&amp;action=review

&gt;&gt;&gt; Source/WebKit/WebProcess/com.apple.WebProcess.sb.in:945
&gt;&gt;&gt; +        (syscall-number SYS_recvmsg)
&gt;&gt; 
&gt;&gt; This one looks suspicious. Looking at the logs, it seems like there is actual networking happening in WebContent, which is not allowed. So we may need a higher level fix here.
&gt; 
&gt; I am no sandboxing expert so I followed the existing pattern. We already allow SYS_recvfrom / SYS_recvfrom_nocancel / SYS_sendto / SYS_sendmsg_nocancel / SYS_sendto_nocancel.

Couldn&apos;t it be a socket used to talk to a daemon, as opposed to actual networking?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556293</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-07-26 17:05:19 -0700</bug_when>
    <thetext>&gt; Couldn&apos;t it be a socket used to talk to a daemon, as opposed to actual networking?

I have no definitive proof, but I doubt it - there&apos;s always com.apple.NSURLConnectionLoader thread in those processes, and usually people who use sockets use them through low level API.

&gt; I am no sandboxing expert so I followed the existing pattern. We already allow SYS_recvfrom / SYS_recvfrom_nocancel / SYS_sendto / SYS_sendmsg_nocancel / SYS_sendto_nocancel.

Maybe all of those are wrong :-O</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556297</commentid>
    <comment_count>7</comment_count>
      <attachid>374998</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2019-07-26 17:24:12 -0700</bug_when>
    <thetext>Comment on attachment 374998
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=374998&amp;action=review

r=me

&gt;&gt;&gt;&gt; Source/WebKit/WebProcess/com.apple.WebProcess.sb.in:945
&gt;&gt;&gt;&gt; +        (syscall-number SYS_recvmsg)
&gt;&gt;&gt; 
&gt;&gt;&gt; This one looks suspicious. Looking at the logs, it seems like there is actual networking happening in WebContent, which is not allowed. So we may need a higher level fix here.
&gt;&gt; 
&gt;&gt; I am no sandboxing expert so I followed the existing pattern. We already allow SYS_recvfrom / SYS_recvfrom_nocancel / SYS_sendto / SYS_sendmsg_nocancel / SYS_sendto_nocancel.
&gt; 
&gt; Couldn&apos;t it be a socket used to talk to a daemon, as opposed to actual networking?

FWIW, in the traces I saw, each call to recvmsg was triggered by a network connection failure. Seems like someone might have tried to do some networking, but didn&apos;t necessarily succeed.

Given that these similar sys calls are already allowed, I&apos;m inclined to allow this one too, so folks can stop crashing while we figure out how to generally remove access to this set of syscalls.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556301</commentid>
    <comment_count>8</comment_count>
      <attachid>374998</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-07-26 17:30:40 -0700</bug_when>
    <thetext>Comment on attachment 374998
Patch

Let&apos;s not be in such a crazy hurry.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556353</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-07-26 23:45:20 -0700</bug_when>
    <thetext>&gt; SYS_sendto 

Used by ASL logging facility, so definitely needed.

&gt; SYS_recvfrom_nocancel 
&gt; SYS_sendmsg_nocancel 
&gt; SYS_sendto_nocancel

Very few tests hit these, http/tests/workers/service/serviceworker-websocket.https.html being one of those.

&gt; SYS_recvfrom 

I didn&apos;t see this one hit on layout tests, but I did see SYS_recvmsg, the same test reproduces it. Maybe the internal implementation in libnetwork switched from one to another after Per Arne&apos;s initial testing.

So WebSockets in service workers try to use networking in WebContent. This appears related to bug 200161 and bug 199906. The former has a fix posted today, so we should re-test and hopefully remove the unnecessary syscalls.

I suggest landing this patch with only SYS_chmod_extended and SYS_lstat_extended added for now. We also need to wire service worker processes to WebKitTestRunner&apos;s crash reporting - it&apos;s quite unfortunate that these crashes are currently silent during tests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1556383</commentid>
    <comment_count>10</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2019-07-27 06:41:59 -0700</bug_when>
    <thetext>Committed r247890: &lt;https://trac.webkit.org/changeset/247890&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>374998</attachid>
            <date>2019-07-26 16:28:52 -0700</date>
            <delta_ts>2019-07-26 17:30:40 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-200182-20190726162851.patch</filename>
            <type>text/plain</type>
            <size>2246</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjQ3ODc5CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IDM1MzQ3Zjk3ZmY5Y2Q1YWQ4
NTgzM2FhOWE2OTVkNzI1YTI0ZjdjZTcuLjNlMTBhODVmNTA1NjczOTJkYTMwOWViMjdhNGY0MmE5
MmQ0ZTRmZmQgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTcgQEAKKzIwMTktMDctMjYgIENocmlzIER1
bWV6ICA8Y2R1bWV6QGFwcGxlLmNvbT4KKworICAgICAgICBBbGxvdyBtb3JlIHN5c2NhbGxzIGlu
IHRoZSBXZWJDb250ZW50IHByb2Nlc3MnIHNhbmRib3ggcHJvZmlsZQorICAgICAgICBodHRwczov
L2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MjAwMTgyCisgICAgICAgIDxyZGFyOi8v
cHJvYmxlbS81MzU5NDk3Mz4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4K
KworICAgICAgICBJIHJldmlld2VkIGFsbCBjcmFzaCB0cmFjZXMgYXR0YWNoZWQgdG8gdGhlIHJh
ZGFyIGFuZCBmb3VuZCB0aGUgZm9sbG93aW5nCisgICAgICAgIHN5c2NhbGxzIHRoYX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
bnVtYmVyIFNZU193b3JrcV9vcGVuKQo=
</data>
<flag name="review"
          id="390793"
          type_id="1"
          status="+"
          setter="ggaren"
    />
    <flag name="commit-queue"
          id="390794"
          type_id="3"
          status="-"
          setter="ap"
    />
          </attachment>
      

    </bug>

</bugzilla>