<?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>210314</bug_id>
          
          <creation_ts>2020-04-09 19:00:11 -0700</creation_ts>
          <short_desc>Fix bad tests in testmasm&apos;s testCagePreservesPACFailureBit().</short_desc>
          <delta_ts>2020-04-10 13:20:31 -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>JavaScriptCore</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>
          
          <blocked>210252</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Lam">mark.lam</reporter>
          <assigned_to name="Mark Lam">mark.lam</assigned_to>
          <cc>ews-watchlist</cc>
    
    <cc>keith_miller</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>tzagallo</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1639991</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2020-04-09 19:00:11 -0700</bug_when>
    <thetext>Some of these tests will crash when validated untagging is enabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1639992</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-04-09 19:00:34 -0700</bug_when>
    <thetext>&lt;rdar://problem/61556785&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1639993</commentid>
    <comment_count>2</comment_count>
      <attachid>396032</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2020-04-09 19:10:13 -0700</bug_when>
    <thetext>Created attachment 396032
proposed patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640047</commentid>
    <comment_count>3</comment_count>
      <attachid>396032</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2020-04-09 23:18:18 -0700</bug_when>
    <thetext>Comment on attachment 396032
proposed patch.

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640048</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2020-04-09 23:26:34 -0700</bug_when>
    <thetext>Thanks for the review.  Landed in r259848: &lt;http://trac.webkit.org/r259848&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640241</commentid>
    <comment_count>5</comment_count>
      <attachid>396032</attachid>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2020-04-10 10:19:34 -0700</bug_when>
    <thetext>Comment on attachment 396032
proposed patch.

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

&gt; Source/JavaScriptCore/assembler/testmasm.cpp:2136
&gt; +        CHECK_NOT_EQ(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1), ptr);

This isn&apos;t quite a strong as the old test. It doesn&apos;t guarantee that the cage gave you a pointer that will crash when dereferenced. However, I think that can be tested by also asserting, 

CHECK_NOT_EQ(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1), removeArrayPtrTag(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1))));</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640311</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2020-04-10 12:34:58 -0700</bug_when>
    <thetext>Landed the additional test in r259890: &lt;http://trac.webkit.org/r259890&gt;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640312</commentid>
    <comment_count>7</comment_count>
      <attachid>396032</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2020-04-10 12:53:44 -0700</bug_when>
    <thetext>Comment on attachment 396032
proposed patch.

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

&gt; Source/JavaScriptCore/ChangeLog:9
&gt; +        Some of these tests will crash when validated untagging is enabled.

why?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640313</commentid>
    <comment_count>8</comment_count>
      <attachid>396032</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2020-04-10 12:54:01 -0700</bug_when>
    <thetext>Comment on attachment 396032
proposed patch.

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

&gt;&gt; Source/JavaScriptCore/ChangeLog:9
&gt;&gt; +        Some of these tests will crash when validated untagging is enabled.
&gt; 
&gt; why?

(You should say that here, not just what, but why)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640315</commentid>
    <comment_count>9</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2020-04-10 12:59:28 -0700</bug_when>
    <thetext>(In reply to Saam Barati from comment #8)
&gt; Comment on attachment 396032 [details]
&gt; proposed patch.
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=396032&amp;action=review
&gt; 
&gt; &gt;&gt; Source/JavaScriptCore/ChangeLog:9
&gt; &gt;&gt; +        Some of these tests will crash when validated untagging is enabled.
&gt; &gt; 
&gt; &gt; why?
&gt; 
&gt; (You should say that here, not just what, but why)

It&apos;s in the title: &quot;when validated untagging is enabled&quot;.  When we start validating the untagged pointer (as in crash if validation fails), we will crash if we are untagging badly tagged pointers on purpose in the test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640316</commentid>
    <comment_count>10</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2020-04-10 13:00:22 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #9)
&gt; (In reply to Saam Barati from comment #8)
&gt; &gt; Comment on attachment 396032 [details]
&gt; &gt; proposed patch.
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=396032&amp;action=review
&gt; &gt; 
&gt; &gt; &gt;&gt; Source/JavaScriptCore/ChangeLog:9
&gt; &gt; &gt;&gt; +        Some of these tests will crash when validated untagging is enabled.
&gt; &gt; &gt; 
&gt; &gt; &gt; why?
&gt; &gt; 
&gt; &gt; (You should say that here, not just what, but why)
&gt; 
&gt; It&apos;s in the title: &quot;when validated untagging is enabled&quot;.  When we start
&gt; validating the untagged pointer (as in crash if validation fails), we will
&gt; crash if we are untagging badly tagged pointers on purpose in the test.

Sorry, not title.  It&apos;s in the bug and ChangeLog description.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640318</commentid>
    <comment_count>11</comment_count>
      <attachid>396032</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2020-04-10 13:03:17 -0700</bug_when>
    <thetext>Comment on attachment 396032
proposed patch.

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

&gt;&gt; Source/JavaScriptCore/assembler/testmasm.cpp:2136
&gt;&gt; +        CHECK_NOT_EQ(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1), ptr);
&gt; 
&gt; This isn&apos;t quite a strong as the old test. It doesn&apos;t guarantee that the cage gave you a pointer that will crash when dereferenced. However, I think that can be tested by also asserting, 
&gt; 
&gt; CHECK_NOT_EQ(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1), removeArrayPtrTag(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1))));

can&apos;t we just assert using some functions that we&apos;re looking at unmapped memory?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1640323</commentid>
    <comment_count>12</comment_count>
      <attachid>396032</attachid>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2020-04-10 13:20:31 -0700</bug_when>
    <thetext>Comment on attachment 396032
proposed patch.

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

&gt;&gt;&gt; Source/JavaScriptCore/assembler/testmasm.cpp:2136
&gt;&gt;&gt; +        CHECK_NOT_EQ(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1), ptr);
&gt;&gt; 
&gt;&gt; This isn&apos;t quite a strong as the old test. It doesn&apos;t guarantee that the cage gave you a pointer that will crash when dereferenced. However, I think that can be tested by also asserting, 
&gt;&gt; 
&gt;&gt; CHECK_NOT_EQ(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1), removeArrayPtrTag(invoke&lt;void*&gt;(cage, taggedNotCagedPtr, 1))));
&gt; 
&gt; can&apos;t we just assert using some functions that we&apos;re looking at unmapped memory?

The point is to ensure you have PAC bits.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>396032</attachid>
            <date>2020-04-09 19:10:13 -0700</date>
            <delta_ts>2020-04-09 23:18:18 -0700</delta_ts>
            <desc>proposed patch.</desc>
            <filename>bug-210314.patch</filename>
            <type>text/plain</type>
            <size>2826</size>
            <attacher name="Mark Lam">mark.lam</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMjU5ODQyKQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE2IEBA
CisyMDIwLTA0LTA5ICBNYXJrIExhbSAgPG1hcmsubGFtQGFwcGxlLmNvbT4KKworICAgIC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va2U8dm9pZCo+KGNhZ2VXaXRob3V0QXV0aGVudGljYXRpb24sIHRhZ2dlZE5v
dENhZ2VkUHRyKSwgdGFnQXJyYXlQdHIocHRyLCAxKSk7CiAgICAgfQogCiAgICAgR2lnYWNhZ2U6
OmZyZWUoR2lnYWNhZ2U6OlByaW1pdGl2ZSwgcHRyKTsK
</data>
<flag name="review"
          id="411465"
          type_id="1"
          status="+"
          setter="ysuzuki"
    />
          </attachment>
      

    </bug>

</bugzilla>