<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Adam,<br>
      <br>
      Thank you for the explanation below!<br>
      Then I'm Okay with the fix as it is.<br>
      <br>
      Dan,<br>
      <br>
      Do you have any suggestions or objections?<br>
      If not, then do I need to add your name to the list of reviewers?<br>
      <br>
      Thanks,<br>
      Serguei<br>
      <br>
      <br>
      On 8/15/19 04:38, Adam Farley8 wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:OF77F9AE74.F8AAAB19-ON00258457.0032BE61-80258457.003FF579@notes.na.collabserv.com"><span>Hi
        Serguei, Daniel,</span>
      <br>
      <br>
      <span>Good to hear you
        like the fix.</span>
      <br>
      <br>
      <span>My intention with
        the testing was to make sure my change didn't break anything
        else. I didn't
        do a code paths check before I ran it though; saturation run.<br>
      </span>
      <br>
      <span>As for writing
        a new test, I'm finding it tricky.</span>
      <br>
      <br>
      <span>Here's the current
        flow:</span>
      <br>
      <br>
      <span>Step 1) VM initialises.</span>
      <br>
      <span>Step 2) VM loads
        a couple of libraries and shuts down if one or more paths is too
        long in
        sun.boot.library.path.</span>
      <br>
      <span>Step 3) JDWP initializes</span>
      <br>
      <span>Step 4) JDWP loads
        a library and shuts down if one or more paths is too long in
        sun.boot.library.path.</span>
      <br>
      <br>
      <span>As you can see,
        Step 2 prevents us from reaching Step 4 with a too-long-path
        (required
        to cause failure).</span>
      <br>
      <br>
      <span>I worked around
        that with my webrev by disabling the bit in os.cpp that enacts
        Step 2.</span>
      <br>
      <br>
      <span>Since my hack
        will be removed in the final webrev, we need another way to
        reach step
        4.</span>
      <br>
      <br>
      <span>So what we need
        to test this change, I believe, is a way to insert Step 2.5)
        Change the
        property to include a too-long path.</span>
      <br>
      <br>
      <span>This allows the
        VM to start up properly, but gives us the excessive path we need
        to test
        the jdwp fix.</span>
      <br>
      <br>
      <span>Right now, I'm
        not seeing a way to do this outside of using the JNI.</span>
      <br>
      <br>
      <span>1) shell script
        launches cpp file.</span>
      <br>
      <span>2) cpp starts
        vm without jdwp.</span>
      <br>
      <span>3) change the
        property.</span>
      <br>
      <span>4) call jdwp library-loading
        method directly.</span>
      <br>
      <span>5) check the return
        code.</span>
      <br>
      <br>
      <span>This seems messy,
        but I'm not seeing a way to initialise jdwp from inside java
        code (which
        sounds better to me).</span>
      <br>
      <br>
      <span>I welcome anyone
        who can think of a better way to do this.</span>
      <br>
      <span><br>
        Best Regards<br>
        <br>
        Adam Farley <br>
        IBM Runtimes<br>
      </span>
      <br>
      <br>
      <tt><span><a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com">"serguei.spitsyn@oracle.com"</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com"><serguei.spitsyn@oracle.com></a> wrote on 15/08/2019
          09:25:36:<br>
          <br>
          > From: <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com">"serguei.spitsyn@oracle.com"</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com"><serguei.spitsyn@oracle.com></a></span></tt>
      <br>
      <tt><span>> To: Adam Farley8 <a class="moz-txt-link-rfc2396E" href="mailto:adam.farley@uk.ibm.com"><adam.farley@uk.ibm.com></a></span></tt>
      <br>
      <tt><span>> Cc: Chris Plummer <a class="moz-txt-link-rfc2396E" href="mailto:chris.plummer@oracle.com"><chris.plummer@oracle.com></a>,
          <br>
          > <a class="moz-txt-link-abbreviated" href="mailto:daniel.daugherty@oracle.com">daniel.daugherty@oracle.com</a>,
          <a class="moz-txt-link-abbreviated" href="mailto:serviceability-dev@openjdk.java.net">serviceability-dev@openjdk.java.net</a></span></tt>
      <br>
      <tt><span>> Date: 15/08/2019 09:25</span></tt>
      <br>
      <tt><span>> Subject: Re: RFR: 8229378: jdwp
          library loader in linker_md.c <br>
          > quietly truncates on buffer overflow</span></tt>
      <br>
      <tt><span>> <br>
          > Hi Adam,<br>
          > <br>
          > The fix itself looks Okay to me.<br>
          > I'm not sure there is any test case in these test suites
          which <br>
          > provide a coverage for it.<br>
          > It looks like you need to develop a unit jtreg unit test
          for this.<br>
          > <br>
          > Thanks,<br>
          > Serguei<br>
          > <br>
          > <br>
          > On 8/13/19 09:28, Adam Farley8 wrote:</span></tt>
      <br>
      <tt><span>> Hi Serguei, Daniel, <br>
          > <br>
          > My testing was limited to the bug specific test case I
          mentioned,
          <br>
          > and the following jdwp tests: <br>
          > <br>
          > test/jdk/com/sun/jdi/Jdwp*<br>
          > test/hotspot/jtreg/serviceability/jdwp <br>
          > <br>
          > Best Regards<br>
          > <br>
          > Adam Farley <br>
          > IBM Runtimes<br>
          > <br>
          > <br>
          > <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com">"serguei.spitsyn@oracle.com"</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com"><serguei.spitsyn@oracle.com></a>
          wrote on <br>
          > 13/08/2019 17:04:43:<br>
          > <br>
          > > From: <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com">"serguei.spitsyn@oracle.com"</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:serguei.spitsyn@oracle.com"><serguei.spitsyn@oracle.com></a>
          <br>
          > > To: <a class="moz-txt-link-abbreviated" href="mailto:daniel.daugherty@oracle.com">daniel.daugherty@oracle.com</a>, Adam Farley8 <br>
          > > <a class="moz-txt-link-rfc2396E" href="mailto:adam.farley@uk.ibm.com"><adam.farley@uk.ibm.com></a>, Chris Plummer
          <a class="moz-txt-link-rfc2396E" href="mailto:chris.plummer@oracle.com"><chris.plummer@oracle.com></a>
          <br>
          > > Cc: <a class="moz-txt-link-abbreviated" href="mailto:serviceability-dev@openjdk.java.net">serviceability-dev@openjdk.java.net</a> <br>
          > > Date: 13/08/2019 17:08 <br>
          > > Subject: Re: RFR: 8229378: jdwp library loader in
          linker_md.c
          <br>
          > > quietly truncates on buffer overflow <br>
          > > <br>
          > > Hi Adam,<br>
          > > <br>
          > > I'm looking at your fix.<br>
          > > Also interested about your testing.<br>
          > > <br>
          > > Thanks,<br>
          > > Serguei<br>
          > > <br>
          > > On 8/13/19 08:48, Daniel D. Daugherty wrote: <br>
          > > I don't see any information about how this change
          was tested...<br>
          > > Is there something on another email thread?<br>
          > > <br>
          > > Dan<br>
          > > <br>
          > <br>
          > > On 8/13/19 11:41 AM, Adam Farley8 wrote: <br>
          > > Hi Chris, <br>
          > > <br>
          > > Thanks! <br>
          > > <br>
          > > I understand we need a second reviewer/sponsor to
          get this change
          <br>
          > > in. Any volunteers?<br>
          > > <br>
          > > Best Regards<br>
          > > <br>
          > > Adam Farley <br>
          > > IBM Runtimes<br>
          > > <br>
          > > <br>
          > > Chris Plummer <a class="moz-txt-link-rfc2396E" href="mailto:chris.plummer@oracle.com"><chris.plummer@oracle.com></a> wrote
          on 12/08/2019
          21:35:06:<br>
          > > <br>
          > > > From: Chris Plummer
          <a class="moz-txt-link-rfc2396E" href="mailto:chris.plummer@oracle.com"><chris.plummer@oracle.com></a> <br>
          > > > To: Adam Farley8
          <a class="moz-txt-link-rfc2396E" href="mailto:adam.farley@uk.ibm.com"><adam.farley@uk.ibm.com></a>, serviceability-<br>
          > > <a class="moz-txt-link-abbreviated" href="mailto:dev@openjdk.java.net">dev@openjdk.java.net</a> <br>
          > > > Date: 12/08/2019 21:35 <br>
          > > > Subject: Re: RFR: 8229378: jdwp library loader
          in linker_md.c
          <br>
          > > > quietly truncates on buffer overflow <br>
          > > > <br>
          > > > Hi Adam,<br>
          > > > <br>
          > > > It looks good to me.<br>
          > > > <br>
          > > > thanks,<br>
          > > > <br>
          > > > Chris<br>
          > > > <br>
          > > > On 8/12/19 7:34 AM, Adam Farley8 wrote: <br>
          > > > Hi All, <br>
          > > > <br>
          > > > This is a known bug, mentioned in a code
          comment. <br>
          > > > <br>
          > > > Here is the fix for that bug. <br>
          > > > <br>
          > > > Reviewers and sponsors requested. <br>
          > > > <br>
          > > > Short version: if you set sun.boot.library.path
          to <br>
          > > > something beyond a system's max path length,
          the <br>
          > > > current code will return an empty string
          (rather than <br>
          > > > printing a useful error message and shutting
          down). <br>
          > > > <br>
          > > > This is also a problem if you've specified
          multiple <br>
          > > > paths with a separator, as this code seems to
          wrongly <br>
          > > > assess whether the *total* length exceeds max
          path <br>
          > > > length. So two 200 char paths on windows will
          cause <br>
          > > > failure, as the total length is 400 (which is
          beyond <br>
          > > > max length for windows). <br>
          > > > <br>
          > > > Note that the os.cpp bit of the webrev will not
          be included
          <br>
          > > > in the final webrev, it just makes this change
          trivially
          <br>
          > > > testable. <br>
          > > > <br>
          > > > Bug: </span></tt><a
        href="https://bugs.openjdk.java.net/browse/JDK-8229378"
        moz-do-not-send="true"><tt><span>https://bugs.openjdk.java.net/browse/JDK-8229378</span></tt></a><tt><span>
          <br>
          > > > Webrev: </span></tt><a
        href="http://cr.openjdk.java.net/~afarley/8229378/webrev/"
        moz-do-not-send="true"><tt><span>http://cr.openjdk.java.net/~afarley/8229378/webrev/</span></tt></a><tt><span>
          <br>
          > > > <br>
          > > > <br>
          > > > Best Regards<br>
          > > > <br>
          > > > Adam Farley <br>
          > > > IBM Runtimes<br>
          > > > <br>
          > > > Unless stated otherwise above:<br>
          > > > IBM United Kingdom Limited - Registered in
          England and Wales
          with <br>
          > > > number 741598. <br>
          > > > Registered office: PO Box 41, North Harbour,
          Portsmouth,
          Hampshire PO6 3AU<br>
          > > Unless stated otherwise above:<br>
          > > IBM United Kingdom Limited - Registered in England
          and Wales
          with <br>
          > > number 741598. <br>
          > > Registered office: PO Box 41, North Harbour,
          Portsmouth, Hampshire
          PO6 3AU<br>
          > Unless stated otherwise above:<br>
          > IBM United Kingdom Limited - Registered in England and
          Wales with
          <br>
          > number 741598. <br>
          > Registered office: PO Box 41, North Harbour, Portsmouth,
          Hampshire
          PO6 3AU</span></tt><span><br>
        Unless stated otherwise above:<br>
        IBM United Kingdom Limited - Registered in England and Wales
        with number
        741598. <br>
        Registered office: PO Box 41, North Harbour, Portsmouth,
        Hampshire PO6
        3AU<br>
      </span>
    </blockquote>
    <br>
  </body>
</html>