Subject: kern/322: Panic when namecache disabled and DIAGNOSTIC option enabled
To: None <gnats-admin>
From: None <osymh@gemini.oscs.montana.edu>
List: netbsd-bugs
Date: 07/05/1994 11:35:12
>Number:         322
>Category:       kern
>Synopsis:       Panic when namecache disabled and DIAGNOSTIC option enabled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul  5 11:35:06 1994
>Originator:     
>Organization:
"	"
>Release:        
>Environment:
	
System: NetBSD 0.9C NetBSD 0.9C (ZEUS) #940701.3: Sun Jul 3 21:47:08 1994 root@:/opt/sys/arch/amiga/compile/ZEUS amiga
Architecture: amiga

>Description:
	
	If name caching is disabled (doingcache = 0) and the kernel was
	compiled with DIAGNOSTIC, attempting to reference a file name
	that contains more than 31 (NCHNAMLEN), a panic will occur.  This
	occurs because the cache_lookup does not check for the name length
	> NCHNAMLEN and disable the enter.  The cache_enter is then called
	with that name and it will panic.  [Name caching was disabled in
	sources supped on July 1 and my kernel was built with the DIAGNOSTIC
	option.  A couple of the files in the src tree were longer than 31
	characters and caused my system to panic while trying to do a sup.]
>How-To-Repeat:
	
	Set doingcache = 0 in vfs_cache.c, add the DIAGNOSTIC option to
	the config file, and build a kernel.  Run that kernel and type in
	a file name with more than 31 characters.
>Fix:
	
	Either the check for NCHNAMLEN in cache_enter should be done after
	the test for doingcache, or the check for doingcache in cache_lookup
	should be done after the length check.
>Audit-Trail:
>Unformatted:

	DIAGNOSTIC option and name cache disabled can cause panic

------------------------------------------------------------------------------