This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask
- From: "Michael N. Moran" <mnmoran at bellsouth dot net>
- To: Andrew Thomas Pinski <pinskia at gmail dot com>
- Cc: Jay <jay dot krell at cornell dot edu>, "<gcc at gcc dot gnu dot org>" <gcc at gcc dot gnu dot org>
- Date: Wed, 27 Aug 2008 11:10:07 -0400
- Subject: Re: obvious race condition in darwin/netbsd __enable_execute_stack due to caching pagesize/mask
- References: <COL101-W38A68D4E6F03CFD76D7CFAE6610@phx.gbl> <98489FCE-774A-47AC-8EE0-8CD17FCAD7A2@gmail.com>
Andrew Thomas Pinski wrote:
On Aug 27, 2008, at 0:27, Jay <jay.krell@cornell.edu> wrote:
size = getpagesize(); \
mask = ~((long) size - 1);
Or even better store size after the store to mask.
That is:
int tmp = getpagesize();
*(volatile*)&mask = ~((long)tmp - 1);
*(volatile*)&size = tmp;
Does this work on machines that support out-of-order
execution? For example, shouldn't there be the
equivalent of a powerpc eieio to ensure that the
stores *happen* in order?
I'm assuming, of course, that Darwin runs on different
processor architectures.