Re: linux/fs/open.c:sys_open() & filename zero copy patch

Linus Torvalds (
Sun, 1 Dec 1996 14:51:19 +0200 (EET)

On Sun, 1 Dec 1996, Ingo Molnar wrote:
> we currently do getname() to copy the pathname from user-space to
> kernel-space. Is this necessary?


> I'm now running a kernel with the following patch, that uses the
> user-space pointer. [the patch is against vanilla 2.1.13]

This is horribly broken.

> the open("temptemp",rw) benchmark went down from 39 usecs to 30 usecs,
> mainly due to the __get_free_page() & free() we are not doing now. [on a
> 100 MHz Neptun]

It "works", but ahs the following problems:
- it accesses user space through a normal pointer. That's a no-no (try
your patch on 2.0.x, for example, or on a m68k machine). Total
- it has race conditions like you wouldn't believe. Because the name is
in user space, a page fault (and thus a reschedule) can occur at any
time we access the name in the filesystem layer: like in the lookup()

> ps. there are some other places where we use getname() ...
> ps2. is it really this easy? :)

No, it really is _not_ that easy.

Sure, it improves performance, but at the same time you get all the funny
"MicroSoft special effects" like random kernel corruption, users who give
pointers into kernel memory and are able to look at kernel data,
non-deterministic behaviour under heavy load etc etc.