Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2002 01:47:14 -0800
From:      David Schultz <dschultz@uclink.Berkeley.EDU>
To:        dslb@tiscali.dk
Cc:        hackers@FreeBSD.ORG
Subject:   Re: The stack and heap
Message-ID:  <20021213094714.GA3951@HAL9000.homeunix.com>
In-Reply-To: <3D9FE83900007F16@cpfe4.be.tisc.dk>
References:  <3D9FE83900007F16@cpfe4.be.tisc.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake dslb@tiscali.dk <dslb@tiscali.dk>:
> I just have a few question about execution of code on the stack or heap.
> It is possible in FreeBSD right? But why does the stack and heap need to
> be executable?
> 
> I have read about mprotect(), but can you change the stack and heap permissions
> with that? If yes how? (the man page tells you almost nothing).
> 
> Btw does the ia32 have both read and execution permissions for the memory
> or is read and execution the same? If it is the same, have this changed
> in ia64?

FreeBSD could, in theory, use non-executable stacks on
architectures that support separate read and execute bits.
(i386 isn't one of them.)  Some operating systems employ
this technique to make buffer overruns hard to exploit.
It isn't quite as easy to implement as you might think,
though.  You need to rethink signal trampolines, and some
programs (e.g. JIT compilers, LISP runtimes) expect their
stacks to be executable.  I don't know exactly how much
work it would be to fix up FreeBSD to use non-executable
stacks, or whether it would be worth it.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021213094714.GA3951>