Linux-kernel mailing list archive 2000-06,: Re: [Basics] spinlocks & copy_to_user

# Re: [Basics] spinlocks & copy_to_user

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 8 Feb 2000 21:14:26 +0000 (GMT)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Matthew Kirkwood: "Re: Source Code Release of NWFS 2.0 for 2.2/2.3/2.4"
- Previous message: H. Peter Anvin: "Re: Access to fa.linux.kernel - please help"

> I need to copy information from a kernel memory buffer to a user memory
> buffer. copy_to_user() is the obvious answer. However, the kernel
> buffer can be modified at interrupt time (interrupt handler); to protect
> this, I'm using a spin_lock_irqsave(). But copy_to_user() can sleep.
> Correct me if I'm wrong, but access_ok() does not appear to worry about
> the possibility of a fault, just permissions.

Correct

> I could copy from the kernel buffer to another kernel buffer with irq's
> disabled, then copy_to_user() from the new buffer, but I was hoping to
> avoid the additional copy.

Is it possible to keep two buffers and modify one in the IRQ handler then
flip them with the user copies - ie is this a flow of data or a control
structure in a fixed format ?

Alan

-
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/

- Next message: Matthew Kirkwood: "Re: Source Code Release of NWFS 2.0 for 2.2/2.3/2.4"
- Previous message: H. Peter Anvin: "Re: Access to fa.linux.kernel - please help"