Too bad that intel designed the CPU incorrectly for this in the first
place.
Intel CPU's don't have a 'x' bit in their page tables: any readable page
is executable.
That still leaves the segment crud, but gag me with a spoon, it's not
actually usable. Yes, you can try to use segments for execution, but
it's not going to work too well. Sane flat-programming-model semantics
essentially require that the data segment overlap the code segment (just
trust me - intel segments aren't flexible enough to do anything else),
which means that any code segment is essentially going to be writable
(not through the code segment itself, but through a data segment alias).
>Write+exec permission can be disabled. It is only used for
>buffer overrun exploits, trampolines, crashme, and other junk.
Sorry, you're wrong. Write+exec _cannot_ be disabled. You can disable
execution permissions on a very selective basis (make the code segment
be less than three GB, so that it doesn't contain the normal stack, for
example), but you cannot be selective enough.
Now, if you had an alpha, you could determine executability on a
page-per-page basis. Of course, if you had an alpha you wouldn't have
this problem in the first place, so..
Linus