From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3E6463858C36; Mon, 27 Nov 2023 17:39:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E6463858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1701106789; bh=I+J3T1hVVjeuXxV5EbloLd3K+08RJy72vqRaG1jsB+U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u5OUkaSt8ZHOZKgtH56mjOxfBSPZf1pDyNir4Ptqnnh9SKhWJ8tWtTrCi4xc+RwRe hb0TP7iR0juHgtKuHF3zGcemEeCKr26+cVirUHGOE5ZMyKq3Zlh1TcApUdS/y6ROoS Z8g7bciQdMFIRbNNt/IkWGZtQy60JakR0Zw92mS0= From: "adhemerval.zanella at linaro dot org" 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: Mon, 27 Nov 2023 17:39:48 +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: adhemerval.zanella at linaro dot org 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: 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 #9 from Adhemerval Zanella --- (In reply to Florian Weimer from comment #8) > (In reply to Adhemerval Zanella from comment #7) > > So the mprotect is essentially a hardening feature, assuming that the > > dynamic object padding/holes might contain gadgets. It still does not > > happen for loader and main program itself, since normally they would be > > mapped by the kernel and its does do anything with holes, >=20 > There's no expectation that these are contiguous in memory, yes. Such an > expectation exists for shared objects loaded by glibc. Right, but my point is if this is a hardening feature that glibc aims to provide it does not help if the kernel still does not provide it for the lo= ader (if this is built with a different page size) and the main program itself. Should we push for kernel to implement a similar handling? And the holes seem to be always from the initial read-only segment, which m= akes the whole gadget avoidance argument moot. This would make sense back when R= ELRO was not wildly used/deployed (even with the current somewhat broken status), but it still does not make much sense to me. >=20 > > and IMHO it should > > up to the static linker to fill the padding with NOP/trap instruction to > > avoid such issues.=20 >=20 > That requires padding to the maximum page size on disk, though. But this is what binutils does [1], and while not being optimized it seems = that it would be somewhat hard to fix it (at least with Fangrui Song suggestion). [1] https://sourceware.org/bugzilla/show_bug.cgi?id=3D30612 --=20 You are receiving this mail because: You are on the CC list for the bug.=