Subject: xsrc/5809: X server crashes unhelpfully
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 07/21/1998 13:13:30
>Number:         5809
>Category:       xsrc
>Synopsis:       X server crashes unhelpfully
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 21 06:20:00 1998
>Last-Modified:
>Originator:     Dave Sainty
>Organization:
Dynamic Technology Services and Products Ltd (NZ)
>Release:        recent sup
>Environment:
System: NetBSD tequila.dave.dtsp.co.nz 1.3F NetBSD 1.3F (TEQUILA) #1: Mon Jul 20 23:24:49 NZST 1998 dave@tequila.dave.dtsp.co.nz:/vol/tequila/userC/NetBSD-current/src/sys/arch/i386/compile/TEQUILA i386


>Description:
	xalloc.c in the X server does not check returns from library calls for
	failure.  This can lead to obscure crashes (Signal 11 trapped blah
	blah), and result in a lengthy bug hunt, including big searches for
	things to delete so you will have enough disk to compile the X server.

>How-To-Repeat:
	Well, now that I know this is the problem my next guess is that it's
	because my libc is out of date, though I'm surprised that this would
	cause this particular result unless some #defines have changed their
	numeric values recently.

>Fix:

Apply this patch to warn of the problem at the source...  Admittedly it is a
little bizarre that this operation could ever fail...

--- xc/programs/Xserver/os/xalloc.c.orig	Fri Aug 22 21:34:30 1997
+++ xc/programs/Xserver/os/xalloc.c	Wed Jul 22 00:47:42 1998
@@ -680,6 +680,9 @@
 #if defined(HAS_MMAP_ANON) || defined (MMAP_DEV_ZERO)
 #if defined(_SC_PAGESIZE) /* || defined(linux) */
     pagesize = sysconf(_SC_PAGESIZE);
+
+    if (pagesize == -1)
+	FatalError("OsInitAllocator: Failed to get pagesize\n");
 #else
 #ifdef HAS_GETPAGESIZE
     pagesize = getpagesize();
>Audit-Trail:
>Unformatted: