Re: 2.2 PATCH: check return from copy_*_user in fs/pipe.c

Linus Torvalds
2001-06-20T05:15:04Z

In article <20010619205924.H5679@stanford.edu>,
Zack Weinberg <zackw@Stanford.EDU> wrote:
>On Tue, Jun 19, 2001 at 07:52:25PM -0700, David S. Miller wrote:
>>
>> Zack Weinberg writes:
>> > It *has* been fixed in 2.4, though. Some sort of compatibility issue?
>>
>> No, some kind of "it doesn't matter" issue.
>
>I can demonstrate user code that behaves differently under 2.2 than
>2.4. The example I have (appended) doesn't suffer data loss, but I
>bet I could make one that did.

Hey, I can demonstrate user code that behaves differently depending on
what compiler options were used etc.

Hint: "undefined behaviour".

If somebody passes in a bad pointer to a system call, you've just
invoced the rule of "the kernel _may_ be nice to you, but the kernel
might just consider you a moron and tell you it worked".

There is no "lost data" or anything else. You've screwed yourself, and
you threw the data away. Don't blame the kernel.

And before you say "it has to return EFAULT", check the standards, and
think about the case of libraries vs system calls - and how do you tell
them apart?

Linus