diff options
author | alfred <alfred@FreeBSD.org> | 2003-02-15 06:04:55 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2003-02-15 06:04:55 +0000 |
commit | 29fb7c2bce463e61580d0653a141df43ac982c4f (patch) | |
tree | 6c098d97cace4a0b11af4f27480aefdb513d245a /sys | |
parent | 4d9a4192f7eb015a646c0400dfb5aa7099a3a402 (diff) | |
download | FreeBSD-src-29fb7c2bce463e61580d0653a141df43ac982c4f.zip FreeBSD-src-29fb7c2bce463e61580d0653a141df43ac982c4f.tar.gz |
Do not allow kqueues to be passed via unix domain sockets.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_event.c | 3 | ||||
-rw-r--r-- | sys/kern/sys_pipe.c | 2 | ||||
-rw-r--r-- | sys/kern/sys_socket.c | 2 | ||||
-rw-r--r-- | sys/kern/uipc_usrreq.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/sys/file.h | 4 |
7 files changed, 18 insertions, 5 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 5e2ac9b..ba3424d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2181,7 +2181,8 @@ struct fileops badfileops = { badfo_poll, badfo_kqfilter, badfo_stat, - badfo_close + badfo_close, + 0 }; static int diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 04d5a77..4910b7e 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -74,7 +74,8 @@ static struct fileops kqueueops = { kqueue_poll, kqueue_kqfilter, kqueue_stat, - kqueue_close + kqueue_close, + 0 }; static void knote_attach(struct knote *kn, struct filedesc *fdp); diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 7fbceb5..2612101 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -104,7 +104,7 @@ static fo_close_t pipe_close; static struct fileops pipeops = { pipe_read, pipe_write, pipe_ioctl, pipe_poll, pipe_kqfilter, - pipe_stat, pipe_close + pipe_stat, pipe_close, DFLAG_PASSABLE }; static void filt_pipedetach(struct knote *kn); diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 9936cd2..bf80a7b 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -57,7 +57,7 @@ struct fileops socketops = { soo_read, soo_write, soo_ioctl, soo_poll, soo_kqfilter, - soo_stat, soo_close + soo_stat, soo_close, DFLAG_PASSABLE }; /* ARGSUSED */ diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 102d156..51c7d84 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1171,6 +1171,13 @@ unp_internalize(controlp, td) error = EBADF; goto out; } + fp = fdescp->fd_ofiles[fd]; + if (!(fp->f_ops->fo_flags & DFLAG_PASSABLE)) { + FILEDESC_UNLOCK(fdescp); + error = EOPNOTSUPP; + goto out; + } + } /* * Now replace the integer FDs with pointers to diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 7891dc6..eba9f5d 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -73,7 +73,7 @@ static fo_close_t vn_closefile; struct fileops vnops = { vn_read, vn_write, vn_ioctl, vn_poll, vn_kqfilter, - vn_statfile, vn_closefile + vn_statfile, vn_closefile, DFLAG_PASSABLE }; int diff --git a/sys/sys/file.h b/sys/sys/file.h index 2ee3a188..bcc418e 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -80,6 +80,7 @@ typedef int fo_kqfilter_t(struct file *fp, struct knote *kn); typedef int fo_stat_t(struct file *fp, struct stat *sb, struct ucred *active_cred, struct thread *td); typedef int fo_close_t(struct file *fp, struct thread *td); +typedef int fo_flags_t; struct fileops { fo_rdwr_t *fo_read; @@ -89,8 +90,11 @@ struct fileops { fo_kqfilter_t *fo_kqfilter; fo_stat_t *fo_stat; fo_close_t *fo_close; + fo_flags_t fo_flags; /* DFLAG_* below */ }; +#define DFLAG_PASSABLE 0x01 /* may be passed via unix sockets. */ + /* * Kernel descriptor table. * One entry for each open kernel vnode and socket. |