Re: can we make anonymous memory non-EXECUTABLE?

From: H. Peter Anvin (hpa@zytor.com)
Date: Tue Jan 08 2002 - 21:44:55 EST


Followup to: <15419.17581.990574.160248@napali.hpl.hp.com>
By author: David Mosberger <davidm@napali.hpl.hp.com>
In newsgroup: linux.dev.kernel
>
> I don't consider SIGSEGV to be a silent failure. Also, I think
> all the evidence is that it's unlikely to break many existing
> apps:
>
> o The bug I described has been present for *years* on
> Alpha and probably all other platforms other than x86;
> even on ia64 it took almost two years before someone
> noticed. It's possible that nobody noticed because
> the code generators were part of a larger program,
> but it's very likely that anyone writing a test program
> would have allocated the non-executable memory, so you'd
> expect *someone* to have run into it at some point.
>
> o Certain libraries such as the Boehm Garbage Collector
> already turn off execute permission by default. While
> there may not be that many apps that use it in a production
> environment, it is my impression that many developers are
> using it as a memory-leak detector (e.g., Mozilla does that).
>
>
> DaveM> Secondly, I do not see any
> DaveM> real gain from any of this and my ports are those that have
> DaveM> I-cache coherency issues :-)
>
> I think that's fine. If the consensus is that apps *should* use
> mprotect() to get executable permission (Linus implied as much) and
> it's an architecture specific choice as to whether this is enforced,
> I'm happy. My belief is that we could make this change on ia64
> without undue burden on programmers. If not, I'm sure I'll find out
> about it and I'm willing to take the responsibility.
>

One way to do this would be to create a newbrk() syscall which takes a
permission argument (for new pages.)

        -hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jan 15 2002 - 21:00:25 EST