[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: RFR: 8229378: jdwp library loader in linker_md.c quietly truncates on buffer overflow
From:       "serguei.spitsyn () oracle ! com" <serguei ! spitsyn () oracle ! com>
Date:       2019-08-29 18:38:02
Message-ID: 3ea2e6ad-a32d-603c-258c-985da4e2f50a () oracle ! com
[Download RAW message or body]

<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>
      Okay, thanks!<br>
      Serguei<br>
      <br>
      <br>
      On 8/29/19 06:26, Adam Farley8 wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:OFBA61079C.095E93D7-ON00258465.0030AB99-80258465.0049CC32@notes.na.collabserv.com"><span>Hi
  Serguei,</span>
      <br>
      <br>
      <span>I haven't actually
        run a fastdebug build before. Will do that now and address the
        issues.</span>
      <br>
      <br>
      <span>Once done, I'll
        re-run the tests I ran, and also the tests you've listed below.</span>
      <br>
      <br>
      <span>Can you advise
        on how "good coverage" is determined, so I know for future bug
        fixes?</span>
      <br>
      <br>
      <span>As for the up-to-date-ness,
        I'll update the build before doing the above.</span>
      <br>
      <br>
      <span>Expect a webrev
        once all of this is complete.<br>
        <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">&lt;serguei.spitsyn@oracle.com&gt;</a> wrote \
on 29/08/2019  03:54:56:<br>
          <br>
          &gt; 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">&lt;serguei.spitsyn@oracle.com&gt;</a></span></tt>
  <br>
      <tt><span>&gt; To: Adam Farley8 <a class="moz-txt-link-rfc2396E" \
href="mailto:adam.farley@uk.ibm.com">&lt;adam.farley@uk.ibm.com&gt;</a></span></tt>  \
                <br>
      <tt><span>&gt; Cc: Chris Plummer <a class="moz-txt-link-rfc2396E" \
href="mailto:chris.plummer@oracle.com">&lt;chris.plummer@oracle.com&gt;</a>,  <br>
          &gt; <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>&gt; Date: 29/08/2019 04:23</span></tt>
      <br>
      <tt><span>&gt; Subject: Re: RFR: 8229378: jdwp
          library loader in linker_md.c <br>
          &gt; quietly truncates on buffer overflow</span></tt>
      <br>
      <tt><span>&gt; <br>
          &gt; Hi Adam,<br>
          &gt; <br>
          &gt; Sorry for the latency.<br>
          &gt; I was in process to build, test and push your fix and got
          the <br>
          &gt; fastdebug build errors below.<br>
          &gt; <br>
          &gt; So, my question is if you've ever built the fastdebug
          version.<br>
          &gt; This change is in the system-dependent code, so it has to
          be tested
          <br>
          &gt; on both Unix and Windows.<br>
          &gt; <br>
          &gt; &gt; My testing was limited to the bug specific test case
          I mentioned,
          <br>
          &gt; and the following jdwp tests: <br>
          &gt; &gt; <br>
          &gt; &gt; test/jdk/com/sun/jdi/Jdwp*<br>
          &gt; &gt; test/hotspot/jtreg/serviceability/jdwp<br>
          &gt; <br>
          &gt; This set of tests does not provide a good coverage.<br>
          &gt; To make sure nothing is broken you need to run the the
          test/jdk/com/sun/jdi<br>
          &gt; and also the following vmTestbase tests:<br>
          &gt; <br>
          &gt;      test/hotspot/jtreg/vmTestbase/nsk/jdi<br>
          &gt;      test/hotspot/jtreg/vmTestbase/nsk/jdb<br>
          &gt;      test/hotspot/jtreg/vmTestbase/nsk/jdwp<br>
          &gt; <br>
          &gt; BTW, your current webrev is not up-to-date:<br>
          &gt;    </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>
  &gt; <br>
          &gt; I guess, the change in the
          src/hotspot/share/runtime/os.cpp became<br>
          &gt; obsolete after your previous fix that was already pushed.<br>
          &gt; <br>
          &gt; Thanks,<br>
          &gt; Serguei<br>
          &gt; <br>
          &gt; . . .<br>
          &gt; In file included from /scratch/sspitsyn/jdk14.1/open/src/<br>
          &gt; jdk.jdwp.agent/unix/native/libjdwp/linker_md.c:37:0:<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/unix/native/<br>
          &gt; libjdwp/linker_md.c: In function ‘dll_build_name':<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/share/native/<br>
          &gt; libjdwp/util.h:46:23: error: ‘Do' undeclared (first use
          in this
          function)<br>
          &gt;          #define strdup(p) Do not use this interface.<br>
          &gt;                                             
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/unix/native/<br>
          &gt; libjdwp/linker_md.c:51:18: note: in expansion of macro
          ‘strdup'<br>
          &gt;          paths_copy = strdup(paths);<br>
          &gt;                                   
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/share/native/<br>
          &gt; libjdwp/util.h:46:23: note: each undeclared identifier is
          reported
          <br>
          &gt; only once for each function it appears in<br>
          &gt;          #define strdup(p) Do not use this interface.<br>
          &gt;                                             
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/unix/native/<br>
          &gt; libjdwp/linker_md.c:51:18: note: in expansion of macro
          ‘strdup'<br>
          &gt;          paths_copy = strdup(paths);<br>
          &gt;                                   
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/share/native/<br>
          &gt; libjdwp/util.h:46:26: error: expected ‘;' before ‘not'<br>
          &gt;          #define strdup(p) Do not use this interface.<br>
          &gt;                                                   
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/unix/native/<br>
          &gt; libjdwp/linker_md.c:51:18: note: in expansion of macro
          ‘strdup'<br>
          &gt;          paths_copy = strdup(paths);<br>
          &gt;                                   
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/share/native/<br>
          &gt; libjdwp/util.h:38:24: error: expected ‘;' before ‘not'<br>
          &gt;          #define free(p) Do not use this interface.<br>
          &gt;                                               
          ^<br>
          &gt;
          /scratch/sspitsyn/jdk14.1/open/src/jdk.jdwp.agent/unix/native/<br>
          &gt; libjdwp/linker_md.c:71:5: note: in expansion of macro
          ‘free'<br>
          &gt;          free(paths_copy);<br>
          &gt;          ^<br>
          &gt; gmake[3]: ***
          [/scratch/sspitsyn/jdk14.1/build/linux-x86_64-server-<br>
          &gt;
          fastdebug/support/native/jdk.jdwp.agent/libjdwp/linker_md.o]
          Error
          1<br>
          &gt; gmake[2]: *** [jdk.jdwp.agent-libs] Error 1<br>
          &gt; gmake[2]: *** Waiting for unfinished jobs....<br>
          &gt; <br>
          &gt; ERROR: Build failed for target 'images' in configuration
          'linux-<br>
          &gt; x86_64-server-fastdebug' (exit code 2) <br>
          &gt; <br>
          &gt; <br>
          &gt; <br>
          &gt; On 8/13/19 09:28, Adam Farley8 wrote:</span></tt>
      <br>
      <tt><span>&gt; Hi Serguei, Daniel, <br>
          &gt; <br>
          &gt; My testing was limited to the bug specific test case I
          mentioned,
          <br>
          &gt; and the following jdwp tests: <br>
          &gt; <br>
          &gt; test/jdk/com/sun/jdi/Jdwp*<br>
          &gt; test/hotspot/jtreg/serviceability/jdwp <br>
          &gt; <br>
          &gt; Best Regards<br>
          &gt; <br>
          &gt; Adam Farley <br>
          &gt; IBM Runtimes<br>
          &gt; <br>
          &gt; <br>
          &gt; <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">&lt;serguei.spitsyn@oracle.com&gt;</a>  \
wrote on <br>  &gt; 13/08/2019 17:04:43:<br>
          &gt; <br>
          &gt; &gt; 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">&lt;serguei.spitsyn@oracle.com&gt;</a>  <br>
          &gt; &gt; To: <a class="moz-txt-link-abbreviated" \
href="mailto:daniel.daugherty@oracle.com">daniel.daugherty@oracle.com</a>, Adam \
                Farley8 <br>
          &gt; &gt; <a class="moz-txt-link-rfc2396E" \
href="mailto:adam.farley@uk.ibm.com">&lt;adam.farley@uk.ibm.com&gt;</a>, Chris \
                Plummer
          <a class="moz-txt-link-rfc2396E" \
href="mailto:chris.plummer@oracle.com">&lt;chris.plummer@oracle.com&gt;</a>  <br>
          &gt; &gt; Cc: <a class="moz-txt-link-abbreviated" \
href="mailto:serviceability-dev@openjdk.java.net">serviceability-dev@openjdk.java.net</a> \
<br>  &gt; &gt; Date: 13/08/2019 17:08 <br>
          &gt; &gt; Subject: Re: RFR: 8229378: jdwp library loader in
          linker_md.c
          <br>
          &gt; &gt; quietly truncates on buffer overflow <br>
          &gt; &gt; <br>
          &gt; &gt; Hi Adam,<br>
          &gt; &gt; <br>
          &gt; &gt; I'm looking at your fix.<br>
          &gt; &gt; Also interested about your testing.<br>
          &gt; &gt; <br>
          &gt; &gt; Thanks,<br>
          &gt; &gt; Serguei<br>
          &gt; &gt; <br>
          &gt; &gt; On 8/13/19 08:48, Daniel D. Daugherty wrote: <br>
          &gt; &gt; I don't see any information about how this change
          was tested...<br>
          &gt; &gt; Is there something on another email thread?<br>
          &gt; &gt; <br>
          &gt; &gt; Dan<br>
          &gt; &gt; <br>
          &gt; <br>
          &gt; &gt; On 8/13/19 11:41 AM, Adam Farley8 wrote: <br>
          &gt; &gt; Hi Chris, <br>
          &gt; &gt; <br>
          &gt; &gt; Thanks! <br>
          &gt; &gt; <br>
          &gt; &gt; I understand we need a second reviewer/sponsor to
          get this change
          <br>
          &gt; &gt; in. Any volunteers?<br>
          &gt; &gt; <br>
          &gt; &gt; Best Regards<br>
          &gt; &gt; <br>
          &gt; &gt; Adam Farley <br>
          &gt; &gt; IBM Runtimes<br>
          &gt; &gt; <br>
          &gt; &gt; <br>
          &gt; &gt; Chris Plummer <a class="moz-txt-link-rfc2396E" \
href="mailto:chris.plummer@oracle.com">&lt;chris.plummer@oracle.com&gt;</a> wrote  on \
12/08/2019  21:35:06:<br>
          &gt; &gt; <br>
          &gt; &gt; &gt; From: Chris Plummer
          <a class="moz-txt-link-rfc2396E" \
href="mailto:chris.plummer@oracle.com">&lt;chris.plummer@oracle.com&gt;</a> <br>  \
                &gt; &gt; &gt; To: Adam Farley8
          <a class="moz-txt-link-rfc2396E" \
href="mailto:adam.farley@uk.ibm.com">&lt;adam.farley@uk.ibm.com&gt;</a>, \
                serviceability-<br>
          &gt; &gt; <a class="moz-txt-link-abbreviated" \
href="mailto:dev@openjdk.java.net">dev@openjdk.java.net</a> <br>  &gt; &gt; &gt; \
Date: 12/08/2019 21:35 <br>  &gt; &gt; &gt; Subject: Re: RFR: 8229378: jdwp library \
loader  in linker_md.c
          <br>
          &gt; &gt; &gt; quietly truncates on buffer overflow <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Hi Adam,<br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; It looks good to me.<br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; thanks,<br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Chris<br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; On 8/12/19 7:34 AM, Adam Farley8 wrote: <br>
          &gt; &gt; &gt; Hi All, <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; This is a known bug, mentioned in a code
          comment. <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Here is the fix for that bug. <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Reviewers and sponsors requested. <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Short version: if you set sun.boot.library.path
          to <br>
          &gt; &gt; &gt; something beyond a system's max path length,
          the <br>
          &gt; &gt; &gt; current code will return an empty string
          (rather than <br>
          &gt; &gt; &gt; printing a useful error message and shutting
          down). <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; This is also a problem if you've specified
          multiple <br>
          &gt; &gt; &gt; paths with a separator, as this code seems to
          wrongly <br>
          &gt; &gt; &gt; assess whether the *total* length exceeds max
          path <br>
          &gt; &gt; &gt; length. So two 200 char paths on windows will
          cause <br>
          &gt; &gt; &gt; failure, as the total length is 400 (which is
          beyond <br>
          &gt; &gt; &gt; max length for windows). <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Note that the os.cpp bit of the webrev will not
          be included
          <br>
          &gt; &gt; &gt; in the final webrev, it just makes this change
          trivially
          <br>
          &gt; &gt; &gt; testable. <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; 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>
          &gt; &gt; &gt; 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>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Best Regards<br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Adam Farley <br>
          &gt; &gt; &gt; IBM Runtimes<br>
          &gt; &gt; &gt; <br>
          &gt; &gt; &gt; Unless stated otherwise above:<br>
          &gt; &gt; &gt; IBM United Kingdom Limited - Registered in
          England and Wales
          with <br>
          &gt; &gt; &gt; number 741598. <br>
          &gt; &gt; &gt; Registered office: PO Box 41, North Harbour,
          Portsmouth,
          Hampshire PO6 3AU<br>
          &gt; &gt; Unless stated otherwise above:<br>
          &gt; &gt; IBM United Kingdom Limited - Registered in England
          and Wales
          with <br>
          &gt; &gt; number 741598. <br>
          &gt; &gt; Registered office: PO Box 41, North Harbour,
          Portsmouth, Hampshire
          PO6 3AU<br>
          &gt; Unless stated otherwise above:<br>
          &gt; IBM United Kingdom Limited - Registered in England and
          Wales with
          <br>
          &gt; number 741598. <br>
          &gt; 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>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic