From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C5D633858005; Thu, 7 Dec 2023 05:11:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5D633858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1701925885; bh=m6RgpQD+66kc4JMj3qOw8/E0CAL7MKhRU1oP0CzKYxY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lO0qHE5Q/sO0ONud30gvnZ+1cqOReV1hreYLbFIYSJ8AhJ4uZtckQYh69p0httNaV bvPAQK1VYjquY7+y43SdGLfTMwPPJAvqdEAY9cmn4v9S4FA7bLAAfK/IdPnVhdePlr ajNOOyTeebqhsVdFMicCpfD/d9Wxv9x/sD865Nww= From: "i at maskray dot me" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/31076] Extra struct vm_area_struct with ---p created when PAGE_SIZE < max-page-size Date: Thu, 07 Dec 2023 05:11:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: i at maskray dot me X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: security- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31076 --- Comment #19 from Fangrui Song --- (In reply to Florian Weimer from comment #18) > (In reply to Kalesh Singh from comment #15) > > AIUI if the runtime-page-size equals the max-page-size, the holes are a= lso > > mapped in as part of the segment mapping and share the same permissions. > > Does this mean that on such systems, any protection it offers becomes v= oid? >=20 > That's my understanding. The current behavior gives programmers the *opti= on* > to avoid mapping extra code on small-page systems, while maintaining > compatibility with large-page systems. The proposed change to over-map to > the next load-segment, to fill the gap, would take away that option. Can you elaborate what the option (and "functionality" below) is? Since 22930c9bf21ea15d0da1477a379029e2de259b69 (1996) rtld just calls `mprotect` = (one extra `struct vm_area_struct` instance, see `sudo grep vm_area_struct /proc/slabinfo`), and the user has no option to control this behavior. > Unmapping (to create a gap) has compatibility implications. I wonder the implications are. If they are related to l_contiguous not accounted for correctly, the user needs to be fixed. > Just to clarify, I'm opposed to a glibc change here mainly because it's n= ot > necessary to enable the desired behavior (fewer VMAs), and it removes > functionality that people might find useful. See my question above. > The link editor merely needs to over-map in the generated LOAD segments, = then > there won't be any gaps for the loader to process. I have thought about this but I feel that a linker change would be intrusive and unsightly: "I've also pondered whether this falls under the purview of linkers." in comment 17. --=20 You are receiving this mail because: You are on the CC list for the bug.=