Date: Fri, 16 Aug 2002 05:52:04 -0700 (PDT) From: Robert Watson <rwatson@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/alpha/osf1 osf1_misc.c src/sys/compat/linux linux_stats.c src/sys/fs/fdescfs fdesc_vnops.c src/sys/fs/fifofs fifo_vnops.c src/sys/kern kern_descrip.c kern_event.c sys_generic.c sys_pipe.c sys_socket.c uipc_socket.c vfs_syscalls.c ... Message-ID: <200208161252.g7GCq4ck083349@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
rwatson 2002/08/16 05:52:03 PDT Modified files: sys/alpha/osf1 osf1_misc.c sys/compat/linux linux_stats.c sys/fs/fdescfs fdesc_vnops.c sys/fs/fifofs fifo_vnops.c sys/kern kern_descrip.c kern_event.c sys_generic.c sys_pipe.c sys_socket.c uipc_socket.c vfs_syscalls.c vfs_vnops.c sys/sys file.h socketvar.h vnode.h Log: Make similar changes to fo_stat() and fo_poll() as made earlier to fo_read() and fo_write(): explicitly use the cred argument to fo_poll() as "active_cred" using the passed file descriptor's f_cred reference to provide access to the file credential. Add an active_cred argument to fo_stat() so that implementers have access to the active credential as well as the file credential. Generally modify callers of fo_stat() to pass in td->td_ucred rather than fp->f_cred, which was redundantly provided via the fp argument. This set of modifications also permits threads to perform these operations on behalf of another thread without modifying their credential. Trickle this change down into fo_stat/poll() implementations: - badfo_poll(), badfo_stat(): modify/add arguments. - kqueue_poll(), kqueue_stat(): modify arguments. - pipe_poll(), pipe_stat(): modify/add arguments, pass active_cred to MAC checks rather than td->td_ucred. - soo_poll(), soo_stat(): modify/add arguments, pass fp->f_cred rather than cred to pru_sopoll() to maintain current semantics. - sopoll(): moidfy arguments. - vn_poll(), vn_statfile(): modify/add arguments, pass new arguments to vn_stat(). Pass active_cred to MAC and fp->f_cred to VOP_POLL() to maintian current semantics. - vn_close(): rename cred to file_cred to reflect reality while I'm here. - vn_stat(): Add active_cred and file_cred arguments to vn_stat() and consumers so that this distinction is maintained at the VFS as well as 'struct file' layer. Pass active_cred instead of td->td_ucred to MAC and to VOP_GETATTR() to maintain current semantics. - fifofs: modify the creation of a "filetemp" so that the file credential is properly initialized and can be used in the socket code if desired. Pass ap->a_td->td_ucred as the active credential to soo_poll(). If we teach the vnop interface about the distinction between file and active credentials, we would use the active credential here. Note that current inconsistent passing of active_cred vs. file_cred to VOP's is maintained. It's not clear why GETATTR would be authorized using active_cred while POLL would be authorized using file_cred at the file system level. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Revision Changes Path 1.32 +3 -3 src/sys/alpha/osf1/osf1_misc.c 1.44 +6 -6 src/sys/compat/linux/linux_stats.c 1.76 +1 -1 src/sys/fs/fdescfs/fdesc_vnops.c 1.71 +3 -2 src/sys/fs/fifofs/fifo_vnops.c 1.154 +10 -8 src/sys/kern/kern_descrip.c 1.43 +8 -5 src/sys/kern/kern_event.c 1.109 +3 -2 src/sys/kern/sys_generic.c 1.114 +10 -8 src/sys/kern/sys_pipe.c 1.43 +6 -4 src/sys/kern/sys_socket.c 1.131 +2 -1 src/sys/kern/uipc_socket.c 1.281 +7 -7 src/sys/kern/vfs_syscalls.c 1.162 +18 -14 src/sys/kern/vfs_vnops.c 1.51 +10 -9 src/sys/sys/file.h 1.93 +4 -3 src/sys/sys/socketvar.h 1.204 +3 -2 src/sys/sys/vnode.h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208161252.g7GCq4ck083349>