Re: copy_from_user() fixu

H. Peter Anvin (hpa@transmeta.com)
Tue, 25 Aug 1998 00:44:38 -0700 (PDT)


> Chris Wedgwood writes:
> > On Tue, Aug 25, 1998 at 12:24:17AM -0700, H. Peter Anvin wrote:
> >
> > > All I'm saying is that if you're relying on EFAULT rather than
> > > SIGSEGV or vice versa, your code is completely, utterly, and
> > > fundamentally broken.
> >
> > If I have a spec. (Unix98) that says when I do blah with blem I can
> > expect EFAULT, then I don't see why I can't expect this.
> >
> > I don't know what POSIX says, but would like to know.
>
> I checked my POSIX book this morning and it doesn't mention
> EFAULT. However, if Unix98 mentions it, we should support it as the
> default.

By the way, for those that don't know; the Unix98 spec is available
at:

http://www.opengroup.org/pubs/catalog/t912.htm

A few excepts:

http://www.opengroup.org/onlinepubs/7908799/xsh/interfaces.html

Use and Implementation of Interfaces

Each of the following statements applies unless explicitly stated
otherwise in the detailed descriptions that follow. If an argument to
a function has an invalid value (such as a value outside the domain of
the function, or a pointer outside the address space of the program,
or a null pointer), the behaviour is undefined.

In other words, relying on *any* particular behaviour for invalid
pointers is in violation of the Unix98 spec.

http://www.opengroup.org/onlinepubs/7908799/xsh/errors.html

[EFAULT]

Bad address
The system detected an invalid address in attempting to use
an argument of a call. The reliable detection of this error cannot be
guaranteed, and when not detected may result in the generation of a
signal, indicating an address violation, which is sent to the
process.

In other words, sending SIGSEGV is explicitly permitted.

-hpa

-
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.altern.org/andrebalsa/doc/lkml-faq.html