Subject: port-alpha/3471: fix for kernel crash (mount_null) in netbsd/alpha
To: None <gnats-bugs@gnats.netbsd.org>
From: Ross Harvey <ross@teraflop.com>
List: netbsd-bugs
Date: 04/09/1997 22:22:51
>Number:         3471
>Category:       port-alpha
>Synopsis:       mount_null crashes kernel because of unimplemented gcc debug stmt
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr  9 22:20:01 1997
>Last-Modified:
>Originator:     Ross Harvey <ross@teraflop.com>
>Organization:
Avalon Computer Systems, Inc.
>Release:        apparently in all releases
>Environment:
	netbsd alpha, bug is actually in gcc alpha target logic
System: NetBSD epsilon.teraflop.com 1.2D NetBSD 1.2D (e) #15: Wed Apr 9 21:12:42 PDT 1997 ross@epsilon.ghs.com:/bsd/ross/e alpha


>Description:
	Diagnostic statements in miscfs/nullfs/null_vnops.c (lines
	555 & 556) call RETURN_PC(x), this is apparently the only
	place in the kernel where the gcc builtin

		__builtin_return_address(frameno)

	is called. It _might_ work with frameno 0 but not with frameno 1. 

>How-To-Repeat:

	Easy.	% cd /tmp
		% mkdir a b a/a b/b
		% sync
		% mount_null a/a b/b

		<<boom, mmu fault on *(NULL) dereference>>
>Fix:
	Kill the macro on alpha, maybe on every target...

	Apply patch in /sys/miscfs/nullfs/

--- /sys/miscfs/nullfs/null.h	Sat May 18 04:36:29 1996
+++ null.h	Wed Apr  9 21:12:04 1997
@@ -64,7 +64,7 @@
 #endif
 };
 
-#if !defined(__GNUC__) || __GNUC__ < 2 || \
+#if defined(__alpha__) || !defined(__GNUC__) || __GNUC__ < 2 || \
 	(__GNUC__ == 2 && __GNUC_MINOR__ < 5)
 #define RETURN_PC(frameno) (void *)0
 #else

>Audit-Trail:
>Unformatted: