<?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>209712</bug_id>
          
          <creation_ts>2020-03-28 19:44:03 -0700</creation_ts>
          <short_desc>REGRESSION (r257867): [GPUP] Use-after-move in RemoteCDMInstance::createSession()</short_desc>
          <delta_ts>2020-04-04 10:01:05 -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>
          
          <blocked>210006</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>darin</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>glenn</cc>
    
    <cc>jer.noble</cc>
    
    <cc>philipj</cc>
    
    <cc>sergio</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1635278</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-03-28 19:44:03 -0700</bug_when>
    <thetext>Use-after-move in RemoteCDMInstance::createSession() of `id` parameter:

RefPtr&lt;WebCore::CDMInstanceSession&gt; RemoteCDMInstance::createSession()
{
    if (!m_factory)
        return nullptr;

    RemoteCDMInstanceSessionIdentifier id;
    m_factory-&gt;gpuProcessConnection().connection().sendSync(Messages::RemoteCDMInstanceProxy::CreateSession(), Messages::RemoteCDMInstanceProxy::CreateSession::Reply(id), m_identifier);
    if (!id)
        return nullptr;
    auto session = RemoteCDMInstanceSession::create(makeWeakPtr(m_factory.get()), WTFMove(id));
    m_factory-&gt;addSession(id, session.copyRef());
    return session;
}

This regressed in:

Bug 208090: [GPUP] Implement Modern EME API in the GPU Process
&lt;https://bugs.webkit.org/show_bug.cgi?id=208090&gt;
&lt;rdar://problem/59955230&gt;
&lt;https://trac.webkit.org/changeset/257867&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1635279</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-03-28 19:44:25 -0700</bug_when>
    <thetext>&lt;rdar://problem/61018795&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1635281</commentid>
    <comment_count>2</comment_count>
      <attachid>394852</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-03-28 19:51:20 -0700</bug_when>
    <thetext>Created attachment 394852
Patch v1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1635283</commentid>
    <comment_count>3</comment_count>
      <attachid>394852</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-03-28 19:52:35 -0700</bug_when>
    <thetext>Comment on attachment 394852
Patch v1

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

&gt; Source/WebKit/WebProcess/GPU/media/RemoteCDMInstance.cpp:94
&gt;      auto session = RemoteCDMInstanceSession::create(makeWeakPtr(m_factory.get()), WTFMove(id));
&gt; -    m_factory-&gt;addSession(id, session.copyRef());
&gt; +    m_factory-&gt;addSession(session-&gt;identifier(), session.copyRef());

How about just removing the WTFMove instead?

&gt; Source/WebKit/WebProcess/GPU/media/RemoteCDMInstanceSession.h:46
&gt; +    RemoteCDMInstanceSessionIdentifier identifier() const { return m_identifier; }

Seems like this is pretty far to go just to fix the use after move.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1635286</commentid>
    <comment_count>4</comment_count>
      <attachid>394852</attachid>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-03-28 19:54:55 -0700</bug_when>
    <thetext>Comment on attachment 394852
Patch v1

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

&gt;&gt; Source/WebKit/WebProcess/GPU/media/RemoteCDMInstanceSession.h:46
&gt;&gt; +    RemoteCDMInstanceSessionIdentifier identifier() const { return m_identifier; }
&gt; 
&gt; Seems like this is pretty far to go just to fix the use after move.

Adding this getter makes it possible for RemoteLegacyCDMFactory::addSession() not to even need the RemoteCDMInstanceSessionIdentifier argument as it can get it from the session object passed in.

I was focusing on making the smallest change possible to fix the use-after-move, but should I go ahead and make that change as well?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1635289</commentid>
    <comment_count>5</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-03-28 19:56:32 -0700</bug_when>
    <thetext>Yes, keep this patch as small as possible. You can do other changes in another patch that is not fixing an obvious problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1635321</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-03-29 01:52:44 -0700</bug_when>
    <thetext>Committed r259176: &lt;https://trac.webkit.org/changeset/259176&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 394852.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1637699</commentid>
    <comment_count>7</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2020-04-04 10:01:05 -0700</bug_when>
    <thetext>(In reply to Darin Adler from comment #5)
&gt; Yes, keep this patch as small as possible. You can do other changes in
&gt; another patch that is not fixing an obvious problem.

Bug 210006: [GPUP] Remove unnecessary RemoteCDMInstanceSessionIdentifier argument from RemoteCDMFactory::addSession()</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>394852</attachid>
            <date>2020-03-28 19:51:20 -0700</date>
            <delta_ts>2020-03-29 01:52:45 -0700</delta_ts>
            <desc>Patch v1</desc>
            <filename>bug-209712-20200328195119.patch</filename>
            <type>text/plain</type>
            <size>2468</size>
            <attacher name="David Kilzer (:ddkilzer)">ddkilzer</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjU5MTY0CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IDc0M2EzNDhjNTgxNmVlYmE4
Yzk3OGUyYzhmZGZiNTY0NjI5MzI4ZWIuLjY0ZjM3YmY0MTUxN2YzNzhkYmY2ZTJhMmRkZDI0ODJl
YjUwMzAyOTcgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTcgQEAKKzIwMjAtMDMtMjggIERhdmlkIEtp
bHplciAgPGRka2lsemVyQGFwcGxlLmNvbT4KKworICAgICAgICBSRUdSRVNTSU9OIChyMjU3ODY3
KTogW0dQVVBdIFVzZS1hZnRlci1tb3ZlIGluIFJlbW90ZUNETUluc3RhbmNlOjpjcmVhdGVTZXNz
aW9uKCkKKyAgICAgICAgPGh0dHBzOi8vd2Via2l0Lm9yZy9iLzIwOTcxMj4KKyAgICAgICAgPHJk
YXI6Ly9wcm9ibGVtLzYxMDE4Nzk1PgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09Q
UyEpLgorCisgICAgICAgICogV2ViUHJvY2Vzcy9HUFUvbWVkaWEvUmVtb3RlQ0RNSW5zdGF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