Re: copy_from_user() fix

H. Peter Anvin (hpa@transmeta.com)
Wed, 26 Aug 1998 15:59:10 -0700 (PDT)


> On Wed, Aug 26, 1998 at 04:17:34AM -0700, David S. Miller wrote:
>
> > Consider a userland pointer verification library that worked in
> > about 10 lines of code by passing the pointer in question to a
> > sys_write() call to /dev/null... but this wouldn't work actually
> > these days due to how the kernel won't even verify the pointer in
> > this case.
>
> Ooo... nice hack.
>
> You could probably implement this by reading /proc/self/maps anyhow,
> it would be several orders of magnitude slower than your suggestion
> though.
>

Nice hack, except it wouldn't work. Verifying pointers in userland is
most easily done by (gack!) reading all bytes of the region in
question; on the x86 using a "rep lodsl" (yes, an actual use for rep
lodsl).

Not necessarily fast, if the region is large, though; but it's still
faster than anything that involves a system call (especially since the
kernel does the effectively same thing.)

-hpa

-
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.altern.org/andrebalsa/doc/lkml-faq.html