lkml.org 
[lkml]   [2000]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to transfer memory from PCI memory directly to user space safely and portable?
On Mon, Nov 27, 2000 at 10:36:34AM -0800, H. Peter Anvin wrote:
> Followup to: <20001126151120.V2272@parcelfarce.linux.theplanet.co.uk>
> By author: Philipp Rumpf <prumpf@parcelfarce.linux.theplanet.co.uk>
> In newsgroup: linux.dev.kernel
> >
> > I hope count isn't provided by userspace here ?
> >
> > > 1. What happens if the user space memory is swapped to disk? Will
> > > verify_area() make sure that the memory is in physical RAM when it returns,
> > > or will it return -EFAULT, or will something even worse happen?
> >
> > On i386, you'll sleep implicitly waiting for the page fault to be handled; in
> > the generic case, anything could happen.
> >
>
> That doesn't sound right. I would expect it to wait for the page to
> be brought in on any and all architectures, otherwise it seems rather
> impossible to write portable Linux kernel code.

The code in question was
memcpy_fromio(user_space_dst, iobase, count);

Assuming user_space_dst is a userspace pointer, what I said is true; on some
architectures we will be dereferencing random pointers in kernel space, and
we won't get -EFAULT right on any architecture.

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

\
 
 \ /
  Last update: 2005-03-22 12:47    [W:0.027 / U:0.444 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site