On Tue, 19 Nov 2002, Tim Robbins wrote:

> I'm glad you brought this up... I'd like to see /dev/devctl made mode 600
> instead of 644 because it does not look very robust and because only one
> devctl can be open at a time.
> The two other security/reliability bugs I can see are that the async
> (ioctl FIOASYNC) and non-blocking (ioctl FIONBIO) flags are not cleared
> between when one process closes the device and another opens it. Leaving

Per-device flags for these ioctls are a pet peeve of mine.  Non-broken
devices have per-open file flags (which may be changed by fcntl; then
changes should not affect blocked reads and writes).  Per-device flags
can't possibly work for this, since there may be more than one open per
device (except for devices that can only be opened once, but its easier
to use the file flags for these too).

The changes to use the per-file O_NONBLOCK/NBIO flag are basically:
- change the ioctl to return (0) at the device level (kern_descrip.c
  adjusts things).
- fix read and write to use their ioflag at the device level.

The O_ASYNC flag is harder to fix.  tty.c provides a canonical example of
non-broken handling of the NBIO O_NONBLOCK flag, but it has a per-device
ASYNC flag.  The flag could easily be per-device but the ownership (the
process that SIGIO gets delivered to) is not so easy to handle correctly
since it is tangled up with controlling tty semantics.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to