This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- Cc: Paolo Bonzini <bonzini at gnu dot org>, gcc-patches at gcc dot gnu dot org, "Joseph S. Myers" <joseph at codesourcery dot com>, Ralf Wildenhues <Ralf dot Wildenhues at gmx dot de>, Mike Stump <mikestump at comcast dot net>, "Loren J. Rittle" <ljrittle at acm dot org>, Kai Tietz <ktietz at redhat dot com>, Dave Korn <dave dot korn dot cygwin at gmail dot com>, Jason Thorpe <thorpej at netbsd dot org>, Krister Walfridsson <krister dot walfridsson at gmail dot com>, Uros Bizjak <ubizjak at gmail dot com>, Richard Henderson <rth at redhat dot com>, Eric Botcazou <ebotcazou at adacore dot com>
- Date: Sat, 4 Jun 2011 13:00:19 +0200 (CEST)
- Subject: Re: [build] Move ENABLE_EXECUTE_STACK to toplevel libgcc
- References: <yddipssrxgx.fsf@manam.CeBiTec.Uni-Bielefeld.DE> <4DE4AEC2.3030502@gnu.org> <yddwrh6rifi.fsf@manam.CeBiTec.Uni-Bielefeld.DE> <4DE50FFB.90501@gnu.org> <yddvcwmrkaj.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
On Fri, 3 Jun 2011, Rainer Orth wrote:
> * FreeBSD uses the unmodified address passed to __enable_execute_stack
> to call mprocted, while all others round both address and size to a
> pagesize boundary. I cannot imagine that FreeBSD supports
> byte-granularity mprotect, so this seems an oversight.
The man page of mprotect on FreeBSD 9 (the next release) states the
following which seems supportive of your theory:
NAME
mprotect -- control the protection of pages
:
DESCRIPTION
The mprotect() system call changes the specified pages to have protection
prot. Not all implementations will guarantee protection on a page basis;
the granularity of protection changes may be as large as an entire
region. A region is the virtual address space defined by the start and
end addresses of a struct vm_map_entry.
Gerald