From m.seaman@infracaninophile.co.uk  Thu Jan 15 13:16:49 2004
Return-Path: <m.seaman@infracaninophile.co.uk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1D1B016A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Jan 2004 13:16:49 -0800 (PST)
Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C104943D53
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Jan 2004 13:16:44 -0800 (PST)
	(envelope-from m.seaman@infracaninophile.co.uk)
Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1])
	by smtp.infracaninophile.co.uk (8.12.10/8.12.10) with ESMTP id i0FLGbfn049781
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 15 Jan 2004 21:16:37 GMT
	(envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk)
Received: (from matthew@localhost)
	by happy-idiot-talk.infracaninophile.co.uk (8.12.10/8.12.10/Submit) id i0FLGahR049780;
	Thu, 15 Jan 2004 21:16:36 GMT
	(envelope-from matthew)
Message-Id: <200401152116.i0FLGahR049780@happy-idiot-talk.infracaninophile.co.uk>
Date: Thu, 15 Jan 2004 21:16:36 GMT
From: Matthew Seaman <m.seaman@infracaninophile.co.uk>
Reply-To: Matthew Seaman <m.seaman@infracaninophile.co.uk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: javaws from jdk-1.4.2p6 SEGV on startup
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         61392
>Category:       java
>Synopsis:       javaws from jdk-1.4.2p6 SEGV on startup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-java
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 15 13:20:16 PST 2004
>Closed-Date:    Fri Jan 16 23:12:59 PST 2004
>Last-Modified:  Fri Jan 16 23:12:59 PST 2004
>Originator:     Matthew Seaman
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Infracaninophile
>Environment:
System: FreeBSD happy-idiot-talk.infracaninophile.co.uk 4.9-STABLE FreeBSD 4.9-STABLE #48: Sat Jan 10 11:20:34 GMT 2004 root@happy-idiot-talk.infracaninophile.co.uk:/usr/obj/usr/src/sys/HAPPY-IDIOT-TALK i386



>Description:

The Java WebStart application javaws from JDK 1.4.2p6 dies repeatably
almost immediately on startup with a segmentation violation:

arbitrary:...j2sdk-image/jre/javaws:% ./javaws
Segmentation fault (core dumped)
arbitrary:...j2sdk-image/jre/javaws:% gdb javawsbin -c javawsbin.core 
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
(no debugging symbols found)...
Core was generated by `javawsbin'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/X11R6/lib/libX11.so.6...
(no debugging symbols found)...done.
Reading symbols from /usr/lib/libc_r.so.4...(no debugging symbols found)...
done.
Reading symbols from /usr/X11R6/lib/libXThrStub.so.6...
(no debugging symbols found)...done.
Reading symbols from /usr/libexec/ld-elf.so.1...(no debugging symbols found)...
done.
#0  0x281d5a21 in _thread_leave_cancellation_point () from /usr/lib/libc_r.so.4
(gdb) bt
#0  0x281d5a21 in _thread_leave_cancellation_point () from /usr/lib/libc_r.so.4
#1  0x281d5d51 in _thread_leave_cancellation_point () from /usr/lib/libc_r.so.4
#2  0x281d64a1 in malloc () from /usr/lib/libc_r.so.4
#3  0x80519b8 in ReadFileToBuffer ()
#4  0x804e511 in parsePropertyFile ()
#5  0x804b20f in LoadCfgFile ()
#6  0x804b16e in LoadConfigurationFile ()
#7  0x80498de in main ()
#8  0x804975a in _start ()
(gdb) info frame
Stack level 0, frame at 0xbfbff340:
 eip = 0x281d5a21 in _thread_leave_cancellation_point; saved eip 0x281d5d51
 called by frame at 0xbfbff370
 Arglist at 0xbfbff340, args: 
 Locals at 0xbfbff340, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xbfbff328, ebp at 0xbfbff340, eip at 0xbfbff344

That's from a JDK compiled -DWITH_DEBUG: exactly the same crash
happens with or without -DWITH_DEBUG.

>How-To-Repeat:

>Fix:

Not known.  Happy to provide core files etc. on request.


>Release-Note:
>Audit-Trail:

From: Greg Lewis <glewis@eyesbeyond.com>
To: Matthew Seaman <m.seaman@infracaninophile.co.uk>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: java/61392: javaws from jdk-1.4.2p6 SEGV on startup
Date: Fri, 16 Jan 2004 17:00:44 -0700

 --0OAP2g/MAC+5xKAE
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Thu, Jan 15, 2004 at 09:16:36PM +0000, Matthew Seaman wrote:
 > The Java WebStart application javaws from JDK 1.4.2p6 dies repeatably
 > almost immediately on startup with a segmentation violation:
 
 Try the attached patch, I'm testing it now, but it will take a few hours.
 
 -- 
 Greg Lewis                          Email   : glewis@eyesbeyond.com
 Eyes Beyond                         Web     : http://www.eyesbeyond.com
 Information Technology              FreeBSD : glewis@FreeBSD.org
 
 
 --0OAP2g/MAC+5xKAE
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="patch-native::util.c"
 
 $FreeBSD$
 
 --- ../../deploy/src/javaws/src/share/native/util.c	22 Oct 2003 23:04:17 -0000	1.1.1.1
 +++ ../../deploy/src/javaws/src/share/native/util.c	16 Jan 2004 23:50:11 -0000
 @@ -27,7 +27,10 @@
  
      /* Find size of file */
      struct stat statBuf;
 -    stat(filename,  &statBuf);
 +    if (stat(filename,  &statBuf) == -1) {
 +        *buffer = NULL;
 +        return 0;
 +    }
      size = statBuf.st_size;
      
      /* Allocate memory for contents */
 
 --0OAP2g/MAC+5xKAE--
State-Changed-From-To: open->closed 
State-Changed-By: glewis 
State-Changed-When: Fri Jan 16 23:12:29 PST 2004 
State-Changed-Why:  
Tested the patch I posted and it worked ok.  Committed that. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=61392 
>Unformatted:
