freebsd-skq/sys
wpaul 97f50d063c Fix a condition where nfs_statfs() can precipitate a panic. There is
code that says this:

        nfsm_request(vp, NFSPROC_FSSTAT, p, cred);
        if (v3)
                nfsm_postop_attr(vp, retattr);
        if (!error)
                nfsm_dissect(sfp, struct nfs_statfs *, NFSX_STATFS(v3));

The problem here is that if error != 0, nfsm_dissect() will not be
called, which leaves sfp == NULL. But nfs_statfs() does not bail out
at this point: it continues processing until it tries to dereference
sfp, which causes a panic. I was able to generate this crash under
the following conditions:

1) Set up a machine as an NFS server and NFS client, with amd running
   (using NIS maps). /usr/local is exported, though any exported fs
   can can be used to trigger the bug.
2) Log in as normal user, with home directory mounted from a SunOS 4.1.3
   NFS server via amd (along with a few other NFS filesystems from same
   machine).
3) Su to root and type the following:
   # mount localhost:/usr/local /mnt
   # df

To fix the panic, I changed the code to read:

        if (!error) {
                nfsm_dissect(sfp, struct nfs_statfs *, NFSX_STATFS(v3));
        } else
                goto nfsmout;

This is a bit kludgy in that nfsmout is a label defined by the nfsm_subs.h
macros, but these macros are themselves more than a little kludgy. This
stops the machine from crashing, but does not fix the overall bug: 'error'
somehow becomes 5 (EIO) when a statfs() is performed on the locally mounted
NFS filesystem. This seems to only happen the first time the filesystem
is accesed: on subsequent accesses, it seems to work fine again.

Now, I know there's no practical use in mounting a local filesystem
via NFS, but doing it shouldn't cause the system to melt down.
1997-06-27 19:10:46 +00:00
..
alpha Grr. Remove not-ready LDT modification fluff that also crept in with 1997-06-02 06:45:17 +00:00
amd64 Removed '#include <machine/smptests.h>' line, no longer needed. 1997-06-27 18:29:55 +00:00
compat/linux Make this thing actually compile. 1997-06-02 10:43:41 +00:00
compile
conf Added CPU_DIRECT_MAPPED_CACHE option which sets L1 cache in direct 1997-06-27 13:46:19 +00:00
contrib/ipfilter/netinet Import version 3.2alpha7 1997-05-25 15:50:46 +00:00
ddb Removed unused #includes. 1997-06-14 11:52:37 +00:00
dev Modified to use renamed get_pci_apic_irq() -> pci_apic_pin() function. 1997-06-25 20:56:29 +00:00
fs More comment cleanup. 1997-06-26 17:12:59 +00:00
geom Removed unused #includes. 1997-06-14 13:56:12 +00:00
gnu Fix a problem with the VN device. Specifically, the VN device can 1997-06-15 17:56:53 +00:00
i386 Removed '#include <machine/smptests.h>' line, no longer needed. 1997-06-27 18:29:55 +00:00
isa Modified to use merged/renamed functions: 1997-06-25 21:00:00 +00:00
isofs/cd9660 Hide the kernel-only stuff inside #ifdef KERNEL. 1997-05-07 13:23:04 +00:00
kern Fill in some extra fields in the eproc structure. gdb uses this information 1997-06-27 15:42:05 +00:00
libkern Style optimization in newly added POSIX range []] conformance, redo 1997-06-07 01:33:10 +00:00
miscfs More comment cleanup. 1997-06-26 17:12:59 +00:00
modules Take the OS release string from the kernel variable `osrelease' 1997-06-24 12:43:18 +00:00
msdosfs Remove redundant check for vp == dvp (done in VFS before calling). 1997-05-17 18:32:53 +00:00
net Fix this damn mbuf with a negative m_len. It turns 1997-06-22 02:19:53 +00:00
netatalk Actually POINT to the appletalk usrreqs struct. 1997-06-02 20:07:33 +00:00
netinet Add for public examination the beginnings of the per-host cache support 1997-06-18 01:24:28 +00:00
netipx Removed the #ifdef IPXERRORMSGS'ed code. Fix a lot of style errors that I 1997-06-26 19:36:03 +00:00
netkey This is the `netkey' kernel key-management service (the PF_KEY analogue 1996-06-14 17:22:18 +00:00
netnatm import Chuck Cranor's ATM driver 1997-05-09 08:04:59 +00:00
netns Remove unneeded member nsp_head from struct nspcb. 1997-04-14 18:26:51 +00:00
nfs Fix a condition where nfs_statfs() can precipitate a panic. There is 1997-06-27 19:10:46 +00:00
nfsclient Fix a condition where nfs_statfs() can precipitate a panic. There is 1997-06-27 19:10:46 +00:00
nfsserver Clear nfs_iodwant[myiod] when the nfsiod process exits due to a signal. 1997-06-25 21:07:26 +00:00
pc98 Synchronize with sys/i386/isa/clock.c and isa.c revisions 1.88 and 1997-06-26 14:49:25 +00:00
pccard Make this puppy compile again - add two includes. 1997-06-01 05:04:39 +00:00
pci Modified to use renamed get_pci_apic_irq() -> pci_apic_pin() function. 1997-06-25 20:56:29 +00:00
powerpc/include Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
rpc Resolve conflicts. 1997-05-28 04:45:15 +00:00
scsi Introduce an advisory exclusive lock on the scsi link structure. 1997-06-25 19:07:43 +00:00
sys Modified to declare merged/renamed functions: 1997-06-25 20:59:15 +00:00
tools Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00
ufs Fix a problem with the VN device. Specifically, the VN device can 1997-06-15 17:56:53 +00:00
vm Don't try upgrading an existing exclusive lock in vm_map_user_pageable. 1997-06-23 21:51:03 +00:00
Makefile Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not 1997-02-22 09:48:43 +00:00