Re: bug in write(2) system call.

Tigran Aivazian (tigran@sco.COM)
Mon, 19 Oct 1998 09:24:27 +0100 (BST)


Alan,

It is true that you said POSIX does not specify it, not even Single UNIX v2...
However, most existing Unix flavours, including Linux, document
read,v(2)/write,v(2) (and many others) as returning EFAULT if the buf is
outside of process' address space. Therefore either the manpage should be
changed (hence cc: Andries) or the "issue" (not a bug, just issue) should
be fixed.

Furthermore, readv(2)/writev(2) already return EFAULT, therefore it would be
nice to make read(2)/write(2) the same, for consistency's sake.

Besides, as the original post came from Oracle, I presume the guys at
Oracle are busy porting their products to Linux (which is good news!) and to
have an implementation as friendly and as comfortable for applications as
possible is in Linux's best interests :)

regards,
Tigran.

On Sat, 17 Oct 1998, Alan Cox wrote:

> > As a continuation of the thread "bug in read(2) syscall" on
> > linux-smp I would like to confirm that the same bug exists in
> > write(2) as well, i.e. write(1, 0, 10) returns 10 instead of -1
> > with errno=EFAULT.
> >
> > This is only when the descriptor is a tty - on files and /dev/null
> > it's okay...
>
> Its also not actually a bug. What happens when you pass invalid pointers is
> undefined by posix. Obviously the Linux idea of undefined doesnt include
> crashes but returning an OK is fine
>

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