Re: copy_from_user() fix

H. Peter Anvin (hpa@transmeta.com)
25 Aug 1998 21:57:03 GMT


Followup to: <19980825133811.20709.qmail@ohse.de>
By author: uwe@ohse.de (Uwe Ohse)
In newsgroup: linux.dev.kernel
>
> In <6rtm8e$9bc$1@palladium.transmeta.com> H. Peter Anvin wrote:
>
> >So, what happens if the libc/kernel interface is changed? You're
> >screwed, because your code is broken.
>
> You'll screw up other people, too.
>
> Please tell me another way to check if some memory range if safe
> to be written to if this doesn't work anymore:
>
> int fd=open("/dev/zero",O_RDONLY);
> ...
> if (read(fd,mem,size)!=(ssize_t) size)
> return -1;
> /* ok */
> return 0;
>
> Please don't tell me to set up signal handlers, i've done that before
> and will not do it again for this purpose. More so inside a library
> which is supposed to (a) not crash and (b) be reasonable fast.
>
> I'm actually using this feature in a logging library of mime,
> and i will _really_ hate it if this doesn't work anymore.
>

This is broken. If you run zlibc, for example, read() is implemented
as a library function. You have no guarantee that that works; and it
may break for reasons that you don't know.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- 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