Re: Anybody out there? (ETXTBSY)

Linus Torvalds (torvalds@transmeta.com)
Fri, 28 Aug 1998 10:42:06 -0700 (PDT)


On 28 Aug 1998, Andi Kleen wrote:
>
> > The reason MAP_EXECUTABLE isn't exported is programs like this:
>
> > fd = open("/var/spool/utmp");
> > mmap( ... fd ... MAP_EXECUTABLE ...);
> > sleep(forever); /* nobody is able to log in */
>
> > which used to actually happen.
>
> How about only allowing MAP_EXECUTABLE on files that have the x bit set?
> This would prevent this attack, and ETXTBSY could be properly implemented.
>
> Or do I miss something here?

There are potentially executable files that we still don't want to allow
MAP_EXECUTABLE on, but yes, that general approach would also have worked.
The reason I disabled MAP_EXECUTABLE completely from user space was that I
had patches for it, not because I felt strongly for that being a
particularly good thing to do.

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.

Linus

-
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