Re: Security question: "Text file busy" overwriting executables but not shared libraries?

From: Eric W. Biederman (
Date: Sun Oct 14 2001 - 13:49:25 EST

Linus Torvalds <> writes:

> On 14 Oct 2001, Eric W. Biederman wrote:
> >
> > Hmm. read-with-PAGE_COPY may not be any faster than read as you still
> > read all of the data into memory, so you have almost the same latency.
> > mmap might work better because of better overlapping of I/O and cpu
> > processing.
> Most of the time, you either have the IO overhead (and whether you use
> read or mmap won't matter all that much, because you're IO limited), or
> the thing is cached.

Thanks that makes sense for where you are targeting the performance

> For gcc, it's cached 99% of the time, because most of the IO ends up being
> header files (this is, of course, assuming that you're compiling a big
> project, but if you're not, the big overhead is in loading _gcc_, not in
> the pages it reads).

O.k. So the case that matters is when you are repeatedly reading from
the cache.

> > Also read-with-PAGE_COPY has some really interesting implications for the
> > page out routines. Because anytime you start the page out you have to
> > copy the page. Not exactly when you want to increase the memory presure.
> No no. Read my thing again. On swap-out, you just move the thing to the
> swap cache.
> Sure, that removes it from the regular cache, and that's possibly a
> performance problem. But

On swap-out the optimization to steal the page from the page cache
makes it much less of a problem. But you still have to be prepared to
do the copy. As there might be multiple users of the page, in which
case you can't steal the page cache copy.

> > And not at all suitable for shared libraries.
> No. Why would you "read" shared libraries? read is read, mmap is mmap. If
> you want mmap, use mmap. Don't mess it up with MAP_COPY, which is not mmap
> at all.

Linus I'm sure you realized that. I'm not certain the whole rest of the world
did. And the shared library topic is what got this discussion going.

Hmm. So what you are looking at is something similiar to O_DIRECT,
but that will instead of doing the I/O and bypassing the page cache,
will instead borrow the page cache copies pages.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:55 EST