Re: PATCH [bugfix for pipe(2) system call]

Jakub Jelinek (jakub@redhat.com)
Wed, 1 Dec 1999 12:11:13 +0100


On Wed, Dec 01, 1999 at 10:37:17AM +0000, Tigran Aivazian wrote:
> On Wed, 1 Dec 1999, Jakub Jelinek wrote:
> > In any case, you should use __copy* variants once the first copy_* succeeds.
>
> Really? In this case there is no need to check for return value on the
> last copy_to_user() either. But I don't think so, because after you have
> done the first copy_from() but before you did the copy_to() (or
> __copy_to as you suggest) the other CPU may have caused some activity that
> swapped out that user page. So you can't use __copy() and you do need to
> check for return.
>
> If the above is incorrect, I would appreciate if you correct me.

Actually swapping a page out does not matter, because it will be swapped in
on behalf of *copy_*, but what you can worry about is that other thread
unmaps the page the pointer points to.
The difference between __copy* and copy* is in that copy* does verify_area
first.
verify_area does full checking on i386 AFAIK, checks whether the passed
address is valid on most other archs (i486+, non-ia32) and is a nop on sparc64.
You should not worry about i386 though because there would be issues just
everywhere with i386 SMP if somebody ran it, on other archs verify_area
can be done just once for each address interval (addr + size), it is not
influenced by anything else than the address value and size.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

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