Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Nov 2002 19:01:46 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Tim Robbins <tjr@FreeBSD.ORG>
Cc:        Kris Kennaway <kris@obsecurity.org>, <current@FreeBSD.ORG>
Subject:   Re: Device permissions with DEVFS
Message-ID:  <20021119184410.D29957-100000@gamplex.bde.org>
In-Reply-To: <20021119174652.A74461@dilbert.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021119184410.D29957-100000>