Subject: kern/6652: swapping to a sparse file fails unpredictably.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <marc@netbsd.org>
List: netbsd-bugs
Date: 12/26/1998 00:23:33
>Number:         6652
>Category:       kern
>Synopsis:       swapping to a sparse file fails unpredictably.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 25 21:35:01 1998
>Last-Modified:
>Originator:     Marc Horowitz
>Organization:
	
>Release:        24 Dec 1998
>Environment:

System: NetBSD horowitz 1.3I NetBSD 1.3I (MARC) #14: Wed Dec 2 02:35:57 EST 1998 marc@horowitz:/u1/netbsd/src/sys/arch/i386/compile/MARC i386


>Description:

If the system tries to swap to a sparse file, it becomes highly
unstable with no visible log or warning.  In my situation, I saw three
failure modes:

1) The system would spontaneously reset.

2) The system would wedge.

3) init's memory would get corrupted.  This would have weird secondary
effects, such as tty's getting reset, init crashing with SIGILL or
SIGSEGV, or init spinning.  The one time I got a good stack trace on
an init spin, it was in
disaster->strsignal->__strsignal->_catopen->getenv->findenv.  (As a
second possible bug, it seems poor for init do be doing this much
extra work when something catastrophic enough happens to disaster to
get called.)

>How-To-Repeat:

	create a sparse file
	swapctl -a /sparsefile
	do something which tries to page into the sparse file

>Fix:

I'm going to commit a change to uvm_swap.c to panic if a write to a
sparse file occurrs.  It would be better to handle this case more
elegantly, but I'm not familiar enough with the code to do that.  A
useful panic() message is better than arbitrary system instability,
IMHO.
>Audit-Trail:
>Unformatted: