This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug pch/48004] doesn't work with randomize_va_space
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 7 Mar 2011 11:07:35 +0000
- Subject: [Bug pch/48004] doesn't work with randomize_va_space
- Auto-submitted: auto-generated
- References: <bug-48004-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48004
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-07 11:07:33 UTC ---
We can't simply use MAP_FIXED, as that will discard existing overlapping
mappings.
MAP_FIXED
Don't interpret addr as a hint: place the mapping at exactly
that address. addr must be a multiple of the page size. If the
memory region specified by addr and len overlaps pages of any
existing mapping(s), then the overlapped part of the existing
mapping(s) will be discarded. If the specified address cannot
be used, mmap() will fail. Because requiring a fixed address
for a mapping is less portable, the use of this option is dis-
couraged.
So we'd need to portably check for existing mappings in the range we want
to request. I don't think that is desirable (if only from a performance
perspective). The only way to do this that I can think of is parsing
/proc or installing a SIGSEGV/SIGBUS handler and poking every page ...