Date: Tue, 18 Aug 2009 20:31:47 GMT From: Jonathan Chen <jon@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/137940: bsd java does not start from nullfs mount when procfs is available Message-ID: <200908182031.n7IKVlEG080018@freefall.freebsd.org> Resent-Message-ID: <200908182040.n7IKe2Io081570@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 137940 >Category: ports >Synopsis: bsd java does not start from nullfs mount when procfs is available >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 18 20:40:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Jonathan Chen >Release: FreeBSD 7.2-STABLE i386 >Organization: >Environment: >Description: When procfs is available, java cannot be started from under nullfs mounts. This is due to /proc/currproc/file returning a symlink to "unknown" instead of the java executable. This can break java in chroot environments setup with nullfs. Problem occurs with jdk15 and jdk16 >How-To-Repeat: mount /proc ; mount -t nullfs /usr/local/java /mnt ; /mnt/bin/java >Fix: The following patch allows java to fall back to non-procfs means of finding itself if procfs does not return an absolute path. --- ../../j2se/src/solaris/bin/java_md.c~ 2009-08-18 15:43:01.000000000 -0400 +++ ../../j2se/src/solaris/bin/java_md.c 2009-08-18 15:43:44.000000000 -0400 @@ -905,7 +905,7 @@ const char* self = "/proc/curproc/file"; char buf[PATH_MAX+1]; int len = readlink(self, buf, PATH_MAX); - if (len >= 0) { + if (len >= 0 && buf[0] == '/') { buf[len] = '\0'; /* readlink doesn't nul terminate */ exec_path = strdup(buf); } --- ../../deploy/src/javaws/solaris/native/system_md.c~ 2009-08-18 15:42:54.000000000 -0400 +++ ../../deploy/src/javaws/solaris/native/system_md.c 2009-08-18 15:43:39.000000000 -0400 @@ -408,7 +408,7 @@ const char* self = "/proc/curproc/file"; char buf[PATH_MAX+1]; int len = readlink(self, buf, PATH_MAX); - if (len >= 0) { + if (len >= 0 && buf[0] == '/') { buf[len] = '\0'; /* readlink doesn't nul terminate */ exec_path = strdup(buf); } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908182031.n7IKVlEG080018>