From owner-freebsd-java@FreeBSD.ORG Tue Mar 18 06:15:32 2008 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A8B2106566B for ; Tue, 18 Mar 2008 06:15:32 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 7AD7E8FC2B for ; Tue, 18 Mar 2008 06:15:31 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c220-239-20-82.belrs4.nsw.optusnet.com.au [220.239.20.82]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m2I6FQwG029345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Mar 2008 17:15:27 +1100 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.2/8.14.1) with ESMTP id m2I6FQ8v078403; Tue, 18 Mar 2008 17:15:26 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.2/8.14.2/Submit) id m2I6FPXT078402; Tue, 18 Mar 2008 17:15:25 +1100 (EST) (envelope-from peter) Date: Tue, 18 Mar 2008 17:15:25 +1100 From: Peter Jeremy To: Greg Lewis Message-ID: <20080318061525.GQ44676@server.vk2pj.dyndns.org> References: <20080316223054.GA46447@server.vk2pj.dyndns.org> <20080317133144.GA4473@misty.eyesbeyond.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f+W+jCU1fRNres8c" Content-Disposition: inline In-Reply-To: <20080317133144.GA4473@misty.eyesbeyond.com> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-java@freebsd.org Subject: Re: jdk15/javaws on amd64 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2008 06:15:32 -0000 --f+W+jCU1fRNres8c Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 17, 2008 at 06:31:44AM -0700, Greg Lewis wrote: >On Mon, Mar 17, 2008 at 09:30:54AM +1100, Peter Jeremy wrote: >> 75310 java CALL stat(0x7fffffffd250,0x7fffffffd6f0) >> 75310 java NAMI "<8B>H<83>[]?1?H<83>[]?AUATUSH<83>H<89>?H<8B>^E?^M= ^R/deploy.jar" >> 75310 java RET stat -1 errno 2 No such file or directory > >That certainly is an interesting path for deploy.jar... > >The path to deploy.jar is set up in deploy/src/javaws/share/native/launche= r.c, >so thats probably a good place to start. I've done some poking at it with both some printf()s and gdb and it appears to be a gcc bug - in fact, I'm surprised it works at all... The relevant function is GetBootClassPath(): char* GetBootClassPath(void) { static char bootclasspath[MAXPATHLEN]; #ifdef _DEBUG sprintf(bootclasspath, "%s%c%s%c%s%c%s",=20 sysGetJarLib(), FILE_SEPARATOR, "javaws_g.jar", PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy_g.j= ar"); #else sprintf(bootclasspath, "%s%c%s%c%s%c%s",=20 sysGetJarLib(), FILE_SEPARATOR, "javaws.jar", PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy.jar= "); #endif return bootclasspath; } Within the jdk build, launcher.c is compiled with: /usr/bin/gcc -I../../src/javaws/share/native -I../../src/javaws/solaris/na= tive -I../../src/javaws/share/native/jpeg -I/home/obj/usr/ports/java/jdk15/= work/control/build/bsd-amd64/tmp/deploy/javaws/jawsgensrc/headers -I/usr/lo= cal/include -I/usr/local/include -D_ALLBSD_SOURCE ../../src/javaws/share/n= ative/launcher.c -c -o /home/obj/usr/ports/java/jdk15/work/control/build/bs= d-amd64/tmp/deploy/javaws/jawsobj/launcher.o The second sysGetJarLib() is passed to sprintf() as the first memory operand (ie (%rsp)) but for reasons known best to gcc, only a 32-bit move is used, leaving the high 32-bits alone. In my case, when sprintf() accesses the 64-bit value it winds up with an arbitrary address inside one of the dynamic libraries. I've tried building a simple test using: cc -O2 -fno-strict-aliasing -pipe -march=3Dnocona -DDMEM foo.c -o foo and the code is compiled correctly (actually, the generated code is basically identical except it correctly uses 64-bit moves). I'm still investigating what has gone wrong. Out of interest, why isn't jdk15 being built using the default CFLAGS? --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --f+W+jCU1fRNres8c Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.8 (FreeBSD) iEYEARECAAYFAkffXf0ACgkQ/opHv/APuIcKagCglYhDmgQF1VnvjvjLusLJkrrz urYAnREoTSqiI66c3Y644BR3lHqHZF4u =dGjN -----END PGP SIGNATURE----- --f+W+jCU1fRNres8c--