lkml.org 
[lkml]   [1998]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: copy_from_user() fix
H. Peter Anvin writes:
> > 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.)

Assuming that you can set up the signal handler once and forget
it. Not true for a library. Also assuming that you don't need to pass
the buffer to a syscall in the first place.

Regards,

Richard....

-
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

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.145 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site