<?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>256328</bug_id>
          
          <creation_ts>2023-05-04 12:08:51 -0700</creation_ts>
          <short_desc>[bmalloc] Scavenger&apos;s Mutex can be used after release.</short_desc>
          <delta_ts>2023-05-11 12:09:20 -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>bmalloc</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Basuke Suzuki">basuke</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1952971</commentid>
    <comment_count>0</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2023-05-04 12:08:51 -0700</bug_when>
    <thetext>Scavenger depends on the Mutex which is allocated by StaticPerProcess::s_mutex. While end of the process, Deallocator will call Scavenger::scavenge() if the object logs are full. At the same timing, StaticPreProcess&apos;s s_mutex can be also destructed. If the latter comes first, then Scavenger::scavenge() uses deallocated Mutex via Deallocator.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1952972</commentid>
    <comment_count>1</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2023-05-04 12:17:17 -0700</bug_when>
    <thetext>It can be solved if StaticPerProcess is replaced with PerProcess</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1952978</commentid>
    <comment_count>2</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2023-05-04 12:41:20 -0700</bug_when>
    <thetext>Yusuke suggested other ideas:
- defining StaticMutex
- add [[clang::no_destroy]]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1952992</commentid>
    <comment_count>3</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2023-05-04 13:25:40 -0700</bug_when>
    <thetext>PerProcess use probably causes RAMification regression sunce it allocates new 16KB page and libpas using platforms were not allocating that page before (but still using StaticPerProcess).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1952995</commentid>
    <comment_count>4</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2023-05-04 13:34:25 -0700</bug_when>
    <thetext>So, probably StaticMutex is way to go, and this is correct since the issue relies on Mutex implementation (right now this problem is platform specific since Darwin and Linux are not having this issue since Mutex does not have destructors)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1954757</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-05-11 12:09:20 -0700</bug_when>
    <thetext>&lt;rdar://problem/109221272&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>