<?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>268713</bug_id>
          
          <creation_ts>2024-02-04 03:27:11 -0800</creation_ts>
          <short_desc>OSAllocator::tryReserveUncommittedAligned() does not detect mmap failures</short_desc>
          <delta_ts>2024-02-06 13:34:25 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Other</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="Elad Lahav">e2lahav</reporter>
          <assigned_to name="Keith Miller">keith_miller</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2010477</commentid>
    <comment_count>0</comment_count>
    <who name="Elad Lahav">e2lahav</who>
    <bug_when>2024-02-04 03:27:11 -0800</bug_when>
    <thetext>The code for allocating an aligned region in the absence of a dedicated API, first calls mmap() to allocate a large range, and then munmap() for trimming it. If mmap() fails (which is quite possible given the initial large value) then tryReserveCommitted() returns nullptr. However, tryReserveUncommittedAligned() does not catch that, and proceeds to call munmap() on a large range it never mapped (4G,4G). On QNX this ended up unmapping most of the shared libraries from under the process.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010704</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2024-02-05 09:26:25 -0800</bug_when>
    <thetext>From reading the code, iOS open source builds also take this code path. Surprisingly, we don&apos;t seem to have seen any bad consequences.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010714</commentid>
    <comment_count>2</comment_count>
    <who name="Elad Lahav">e2lahav</who>
    <bug_when>2024-02-05 09:39:00 -0800</bug_when>
    <thetext>There are a couple of preconditions before you can observe something bad happening:

1. The mmap() call needs to fail. I don&apos;t know what flavour of mmap() is used in the iOS version, but if it is lazy it may never fail. In QNX, with the existing code, it is asking for 8GB of fully-allocated memory.
2. The munmap() call needs to hit something that is already allocated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010743</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-02-05 11:18:32 -0800</bug_when>
    <thetext>&lt;rdar://problem/122325706&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010745</commentid>
    <comment_count>4</comment_count>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2024-02-05 11:22:44 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/23875</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2011141</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-02-06 13:33:52 -0800</bug_when>
    <thetext>Committed 274171@main (c4f8b92246b4): &lt;https://commits.webkit.org/274171@main&gt;

Reviewed commits have been landed. Closing PR #23831 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>