Subject: Re: pipe(2) and invalid fildes
To: None <tech-userlevel@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: tech-userlevel
Date: 10/09/2001 10:21:59
mouse@Rodents.Montreal.QC.CA (der Mouse) writes:

>> Aren't you supposed to get EFAULT back instead of a core signal on
>> system calls?

>For most of them, yes.  That is the basis on which one could argue that
>the present semantics for pipe, when passed an invalid address, are
>wrong.

>Whether this is part of the spec (to the extent that "the spec" exists)
>I don't know.

At least its part of history. Segfaults in user mode caused a signal,
segfaults in kernel mode caused a panic. System calls that got passed
a pointer therefore had to check a pointer before using it in the copyin()/
opyout() routines and other places, and returned EFAULT when the pointer
was considered bad.

Now, pipe() is no longer a simple system call that passes a pointer to
the kernel, thus the different behaviour.

I don't feel that it is right to emulate old behaviour when semantics
have changed. EFAULT means: the kernel cannot use a pointer passed to it,
if the kernel doesn't get a pointer returning EFAULT is wrong.


-- 
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."