RFR: 8194154 patch for crash at File.getCanonicalPath()

yumin qi yumin.qi at gmail.com
Thu Feb 8 17:35:45 UTC 2018

HI, Alan

  As in your email to RFR of 8194154 which now has a new fix in
canonicalize_md.c, switch back to discuss solution here again.
  The current fix is not in java, instead, I put it in C function. In the
function before the fix, it assumes no more "//" pattern in the string so
failed to get correct substrings with the case as the test case.
  The fix should not cause other problem since it does double check if
double or more slashes in sequential.

  The APIs indicates 'user.dir' etc system property should not be
rewritten, but did not prevent modifying them in practise.


On Tue, Jan 2, 2018 at 6:09 PM, Wenqian Pei <wenqian.peiwq at alibaba-inc.com>

> Can you please review this patch?
> Thanks in advance!
> Wenqian Pei
> ------------------------------------------------------------------发件人:Alan
> Bateman <Alan.Bateman at oracle.com>发送时间:2018年1月3日(星期三) 01:30收件人:裴文谦(右席) <
> wenqian.peiwq at alibaba-inc.com>; core-libs-dev <core-libs-dev at openjdk.java.
> net>抄 送:陆传胜(传胜) <chuansheng.lcs at alipay.com>; 李三红(三红) <
> sanhong.lsh at alibaba-inc.com>主 题:Re: RFR: 8194154 patch for crash at
> File.getCanonicalPath()
> On 25/12/2017 09:40, Wenqian Pei wrote:
> > Hi:
> >
> > Bug: https://bugs.openjdk.java.net/browse/JDK-8194154
> >
> > We found that if user defines -Duser.dir like "/
> home/a/b/c/", jvm will crash at File.getCanonicalPath() in
> java process bootstrap (before invoking user's java code). The native
> implematation of canonicalize_md.c:collapsible(char *names)
> has problem in processing double '/', parameter 'names'
> need normalized before JNI_CALL.
> >
> user.dir is a "read-only" property and should never be changed on the
> command-line or in a running VM (it breaks APIs in other areas to have
> user.dir be different to the actual working directory). Someday we need
> to figure out how to enforce this.
> In the mean-time, the runtime shouldn't crash so I agree it
> should be fixed.
> -Alan.

More information about the core-libs-dev mailing list