Re: i486 emu in mainline?

Andrew Morton
2004-05-23T09:21:43Z

Willy Tarreau <willy@w.ods.org> wrote:
>
> On Sun, May 23, 2004 at 09:13:20AM +0200, Arjan van de Ven wrote:
> > on first look it seems to be missing a bunch of get_user() calls and
> > does direct access instead....
>
> It was intentional for speed purpose. The areas are checked once with
> verify_area() when we need to access memory, then data is copied directly
> from/to memory. I don't think there's any risk, but I can be wrong.

verify_area() simply checks that the address is a legal one for a userspace
access (it's not a chunk of kernel memory). But the kernel can still take
a pagefault when accessing the address, so you need to use the uaccess
functions which will handle the fault appropriately.

That's put_user(), get_user(), copy_*_user(), etc. Those functions
internally perform verify_area(), so if you've already done a verify_area()
you can use __put_user(), __get_user(), etc which skip the verify_area()
but which still know how to deal with user address faults.