freebsd-dev/sys/compat/linux
Robert Watson ea6027a8e1 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
2002-08-16 12:52:03 +00:00
..
linux_file.c Fix missing parens in MAC readdir() check. This fix was in the MAC 2002-08-12 01:18:33 +00:00
linux_getcwd.c - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
linux_ioctl.c - Remove the Giant acquisition from linux_socket_ioctl() as it was really 2002-06-26 15:53:11 +00:00
linux_ioctl.h Deal with a few issues that cropped up following the recent changes 2001-11-19 15:43:50 +00:00
linux_ipc.c Fix typo in the BSD copyright: s/withough/without/ 2002-06-02 20:05:59 +00:00
linux_ipc.h Remove __P. 2002-03-20 05:48:58 +00:00
linux_mib.c sysctl -w -> sysctl 2002-05-11 06:06:11 +00:00
linux_mib.h Fixed some style bugs in the removal of __P(()). Tabs before "__P((" 2002-03-24 04:04:50 +00:00
linux_misc.c - Replace v_flag with v_iflag and v_vflag 2002-08-04 10:29:36 +00:00
linux_signal.c Fix typo in the BSD copyright: s/withough/without/ 2002-06-02 20:05:59 +00:00
linux_signal.h Remove __P. 2002-03-20 05:48:58 +00:00
linux_socket.c Fix typo in the BSD copyright: s/withough/without/ 2002-06-02 20:05:59 +00:00
linux_socket.h Fix typo in the BSD copyright: s/withough/without/ 2002-06-02 20:05:59 +00:00
linux_stats.c Make similar changes to fo_stat() and fo_poll() as made earlier to 2002-08-16 12:52:03 +00:00
linux_sysctl.c KSE Milestone 2 2001-09-12 08:38:13 +00:00
linux_uid16.c Rework logic of syscalls that modify process credentials as described in 2002-04-13 23:11:23 +00:00
linux_util.c Simple p_ucred -> td_ucred changes to start using the per-thread ucred 2002-02-27 18:32:23 +00:00
linux_util.h Remove __P. 2002-03-20 05:48:58 +00:00