Re: pledge: audio ioctls on disconnected devices

2016-01-18 Thread Alexandre Ratchov
On Mon, Jan 18, 2016 at 01:35:46PM +0100, Sebastien Marie wrote: > On Mon, Jan 18, 2016 at 12:55:30PM +0100, Alexandre Ratchov wrote: > > > > Unfortunately, if pledge is used, pledge_ioctl() checks if the > > vnode type is VCHR and the process ends up killed. > > > > The diff below fixes this by

Re: pledge: audio ioctls on disconnected devices

2016-01-18 Thread Theo de Raadt
> On Mon, Jan 18, 2016 at 12:55:30PM +0100, Alexandre Ratchov wrote: > > > > Unfortunately, if pledge is used, pledge_ioctl() checks if the > > vnode type is VCHR and the process ends up killed. > > > > The diff below fixes this by accepting the audio ioctls if the > > vnode type is VBAD. > >

Re: pledge: audio ioctls on disconnected devices

2016-01-18 Thread Sebastien Marie
On Mon, Jan 18, 2016 at 06:05:31PM +0100, Alexandre Ratchov wrote: > On Mon, Jan 18, 2016 at 01:35:46PM +0100, Sebastien Marie wrote: > > On Mon, Jan 18, 2016 at 12:55:30PM +0100, Alexandre Ratchov wrote: > > > > I am unsure about returning 0 for something we know is wrong to do. > > heh, it's

Re: pledge: audio ioctls on disconnected devices

2016-01-18 Thread Sebastien Marie
On Mon, Jan 18, 2016 at 12:55:30PM +0100, Alexandre Ratchov wrote: > > Unfortunately, if pledge is used, pledge_ioctl() checks if the > vnode type is VCHR and the process ends up killed. > > The diff below fixes this by accepting the audio ioctls if the > vnode type is VBAD. > I am unsure

pledge: audio ioctls on disconnected devices

2016-01-18 Thread Alexandre Ratchov
If a usb audio device is disconnected, the device vnode is closed and replaced by a deadfs vnode, of type VBAD. The sndiod process still has a descriptor in use for which any ioctl() fails. It's supposed to get the return value, notice the error and close the file descriptor. Unfortunately, if

Re: pledge: audio ioctls on disconnected devices

2016-01-18 Thread Alexandre Ratchov
On Mon, Jan 18, 2016 at 12:55:30PM +0100, Alexandre Ratchov wrote: > If a usb audio device is disconnected, the device vnode is closed > and replaced by a deadfs vnode, of type VBAD. The sndiod process > still has a descriptor in use for which any ioctl() fails. It's > supposed to get the return

Re: pledge: audio ioctls on disconnected devices

2016-01-18 Thread Alexandre Ratchov
On Mon, Jan 18, 2016 at 06:56:29PM +0100, Sebastien Marie wrote: > > Modulo the ENOTTY error code (see previous comment), yes the purpose is > to early return from pledge_ioctl(). pledge(2) permits to expose only a > portion of deeper kernel code for a set of defined operations. > Better diff: