diff options
author | dd <dd@FreeBSD.org> | 2005-06-25 03:34:49 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2005-06-25 03:34:49 +0000 |
commit | 1d30c90da0046704aaa5d352be8fdfaeaaa182f6 (patch) | |
tree | 699360fccb9f39082808795a0f18809193d5378a /sys/kern | |
parent | 747a4a0236c52db7b0754888c702f1e9612d5eba (diff) | |
download | FreeBSD-src-1d30c90da0046704aaa5d352be8fdfaeaaa182f6.zip FreeBSD-src-1d30c90da0046704aaa5d352be8fdfaeaaa182f6.tar.gz |
Fix fdcheckstd to pass the file descriptor along through vn_open. When
opening a device, devfs_open needs the file descriptor to install its
own fileops. Failing to pass the file descriptor causes the vnode to
be returned with the regular vnops, which will cause a panic on the
first read or write because devfs_specops is not meant to support
those operations.
This bug caused a panic after exec'ing any set[ug]id program with
fds 0..2 closed (i.e., if any action had to be taken by fdcheckstd, we
would panic if the exec'd program ever tried to use any of those
descriptors).
Reviewed by: phk
Approved by: re (scottl)
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 81c6a38..d30fb65 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1803,7 +1803,7 @@ fdcheckstd(struct thread *td) NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, "/dev/null", td); flags = FREAD | FWRITE; - error = vn_open(&nd, &flags, 0, -1); + error = vn_open(&nd, &flags, 0, fd); if (error != 0) { /* * Someone may have closed the entry in the |