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

Jakub Jelinek (jakub@redhat.com)
Wed, 1 Dec 1999 10:29:33 +0100


On Wed, Dec 01, 1999 at 09:02:46AM +0000, David Howells wrote:
>
> I've produced a patch which should make sure that sys_pipe() checks that the
> memory it has been asked to write into is actually present and writable.

Does POSIX say anything about pipe not clobbering the two int array pointed
on arg if it returns error? For EFAULT it can obviously clobber it (e.g. if
one int is at the very end of maped page and the other one is outside of
vmas), so I wonder why it would not be allowed to clobber it for any error.
Then you could avoid copy_from_user.
In any case, you should use __copy* variants once the first copy_* succeeds.

>
> I've put an implementation in for all the platforms that seemed to care
> already. Not all of them do... is this because they don't have the
> copy_*_user() macros?

No, they do, but they have better ways of passing the pipe file descriptors
to userland. Like sparc passes pipe[0] in %o0 and pipe[1] in %o1 register,
compatibly to SunOS. Actually, this makes a difference, because
pipe(NULL) will give you a segfault on SPARC because it will be glibc who
dereferences the NULL pointer.

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/