[lkml]   [1998]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectETXTBSY: Read The F. Patch before you comment on it
Linus Torvalds writes the following:
>I actually like best the suggestion somebody had which was to do it
>automatically when both the file and the mapping are executable, and
>continue to use the MAP_EXECUTABLE flag as a purely kernel internal one.


*growing impatience*

That's what I did with the patch I sent here what seems like years ago (OK,
maybe a week), and still I've got no response except a bunch of these little
side discussions that never would have occurred if people had read my
analysis of THE SAME ISSUES in the original post.

I would have appreciated some useful commentary, relating to some of the
still unanswered questions I asked at the beginning. (For example, why is
MAP_DENYWRITE ignored in sys_mmap in every arch/ directory except sparc?)

Is it too much to ask of the 10 or so people now involved in the discussion
that maybe ONE of you could read my patch, and talk about its merit?

*resisting the urge to #include a copy of every message I've sent so far*

The original message, where I explain _why_ and _how_ this patch works, is
The first message contained a bad patch, the revised one is in

My patch differs from your suggestion in a minor way: I just return EACCES if
you attempt to PROT_EXEC something without x permission. If you think it
necessary to allow the PROT_EXEC and just not do the MAP_DENYWRITE, I could
do that just as easily, but I have been running this patch for a week or so
now, and haven't hit any problems, and I have a good mix of libc4, libc5, and
libc6 binaries here, so if there was a problem with it being the way it is, I
should have run into it by now.

Here is a test run which shows all the effects of my patch:

chmod("/tmp/ls", 0600) = 0
open("/tmp/ls", O_RDONLY) = 3
mmap(0, 4096, PROT_EXEC, MAP_PRIVATE, 3, 0) = -1 EACCES (Permission denied)
mmap(0, 4096, PROT_NONE, MAP_PRIVATE, 3, 0) = 0x400b0000
mprotect(0x400b0000, 4096, PROT_EXEC) = -1 EACCES (Permission denied)
close(3) = 0
chmod("/tmp/ls", 0700) = 0
open("/tmp/ls", O_RDONLY) = 3
open("/tmp/ls", O_WRONLY) = 4
mmap(0, 4096, PROT_EXEC, MAP_PRIVATE, 3, 0) = -1 ETXTBSY (Text file busy)
mmap(0, 4096, PROT_NONE, MAP_PRIVATE, 3, 0) = 0x400b1000
mprotect(0x400b1000, 4096, PROT_EXEC) = -1 ETXTBSY (Text file busy)
close(4) = 0
mprotect(0x400b1000, 4096, PROT_EXEC) = 0
open("/tmp/ls", O_WRONLY) = -1 ETXTBSY (Text file busy)
munmap(0x400b1000, 4096) = 0
mmap(0, 4096, PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400b1000
open("/tmp/ls", O_WRONLY) = -1 ETXTBSY (Text file busy)

Alan Curry

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

 \ /
  Last update: 2005-03-22 13:44    [W:0.052 / U:0.096 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site