Re: Proposal for kernel change

From: Alexander Viro (viro@math.psu.edu)
Date: Mon Jan 24 2000 - 11:01:27 EST


On Mon, 24 Jan 2000, Alan Cox wrote:

> > > read and write sometimes lock and DMA from user pages in new driver toys
> > > using Stephen's rawio and kiovec stuff. You would need to be careful how
> > > you arranged it to avoid shooting yourself in the foot on future optimisations
> >
> > Ouch... And what happens if we do write() _not_ from user page? I can't
> > think of a place that would write to character device from kernel space,
> > but...
>
> I can't at the moment but it would be bad to preclude it.

Precisely. So leaving all this stuff to clever driver is not enough to be
safe - for copy_*_user() set_fs() trick happens to work, but it will not
save us for anything that plays games with wiring pages down and doing
DMA... Notice that it all boils down to the right choice of 'bring me the
data' function (copy_from_user/copying from iovec/bringing the page
in-core to DMAable place and wiring it/doing nothing/etc.), but there are
two places that contribute to the choice - type of source (user vs. kernel
and plain vs. iovec) and nature of driver (copy vs. DMA). And those places
know nothing about each other...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:12 EST