From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2906 invoked by alias); 7 Mar 2011 11:07:42 -0000 Received: (qmail 2894 invoked by uid 22791); 7 Mar 2011 11:07:41 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Mar 2011 11:07:37 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug pch/48004] doesn't work with randomize_va_space X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: pch X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 07 Mar 2011 11:07:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00588.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48004 Richard Guenther changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #5 from Richard Guenther 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 ...