public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64
@ 2023-05-16 14:13 fweimer at redhat dot com
2023-05-16 14:16 ` [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment fweimer at redhat dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2023-05-16 14:13 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
Bug ID: 30452
Summary: elf/tst-map-32bit-1a fails with
binutils-2.30-117.el8.x86_64
Product: glibc
Version: 2.38
Status: NEW
Severity: normal
Priority: P2
Component: dynamic-link
Assignee: unassigned at sourceware dot org
Reporter: fweimer at redhat dot com
Target Milestone: ---
Target: x86_64-linux-gnu
For some reason, BFD ld produces load segments which are 2 MiB aligned:
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000ff0
0x000ff0 R E 0x200000
LOAD 0x001e00 0x0000000000201e00 0x0000000000201e00 0x000270
0x000280 RW 0x200000
This means that the fast path in _dl_map_segment is not taken, and the
combination of address zero with MAP_DENYWRITE is never used, so MAP_32BIT
handling does not kick in.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
@ 2023-05-16 14:16 ` fweimer at redhat dot com
2023-05-17 18:38 ` hjl.tools at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2023-05-16 14:16 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|elf/tst-map-32bit-1a fails |LD_PREFER_MAP_32BIT_EXEC
|with |does not work with 2MiB
|binutils-2.30-117.el8.x86_6 |load segment alignment
|4 |
CC| |fweimer at redhat dot com
--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Seen with binutils-2.30-117.el8.x86_64.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
2023-05-16 14:16 ` [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment fweimer at redhat dot com
@ 2023-05-17 18:38 ` hjl.tools at gmail dot com
2023-05-17 18:45 ` fweimer at redhat dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2023-05-17 18:38 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
This won't work with 2MB page size:
mmap(NULL, 6291464, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f11bce7f000
mmap(0x7f11bd000000, 4194312, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7f11bd000000
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
2023-05-16 14:16 ` [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment fweimer at redhat dot com
2023-05-17 18:38 ` hjl.tools at gmail dot com
@ 2023-05-17 18:45 ` fweimer at redhat dot com
2023-05-17 20:16 ` hjl.tools at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2023-05-17 18:45 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
The issue is that only the fast path uses MAP_DENYWRITE with a file descriptor,
and that's required for MAP_32BIT being added.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
` (2 preceding siblings ...)
2023-05-17 18:45 ` fweimer at redhat dot com
@ 2023-05-17 20:16 ` hjl.tools at gmail dot com
2023-05-18 17:22 ` hjl.tools at gmail dot com
2023-06-30 17:43 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2023-05-17 20:16 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |hjl.tools at gmail dot com
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 14886
--> https://sourceware.org/bugzilla/attachment.cgi?id=14886&action=edit
A patch
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
` (3 preceding siblings ...)
2023-05-17 20:16 ` hjl.tools at gmail dot com
@ 2023-05-18 17:22 ` hjl.tools at gmail dot com
2023-06-30 17:43 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2023-05-18 17:22 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14886|0 |1
is obsolete| |
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 14888
--> https://sourceware.org/bugzilla/attachment.cgi?id=14888&action=edit
A patch with a testcase
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
` (4 preceding siblings ...)
2023-05-18 17:22 ` hjl.tools at gmail dot com
@ 2023-06-30 17:43 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-30 17:43 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=30452
--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6259ab39410cdefc80077afea48ca9cb057f6005
commit 6259ab39410cdefc80077afea48ca9cb057f6005
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Jun 22 14:30:31 2023 -0700
ld.so: Always use MAP_COPY to map the first segment [BZ #30452]
The first segment in a shared library may be read-only, not executable.
To support LD_PREFER_MAP_32BIT_EXEC on such shared libraries, we also
check MAP_DENYWRITE to decide if MAP_32BIT should be passed to mmap.
Normally the first segment is mapped with MAP_COPY, which is defined
as (MAP_PRIVATE | MAP_DENYWRITE). But if the segment alignment is
greater than the page size, MAP_COPY isn't used to allocate enough
space to ensure that the segment can be properly aligned. Map the
first segment with MAP_COPY in this case to fix BZ #30452.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-06-30 17:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 14:13 [Bug dynamic-link/30452] New: elf/tst-map-32bit-1a fails with binutils-2.30-117.el8.x86_64 fweimer at redhat dot com
2023-05-16 14:16 ` [Bug dynamic-link/30452] LD_PREFER_MAP_32BIT_EXEC does not work with 2MiB load segment alignment fweimer at redhat dot com
2023-05-17 18:38 ` hjl.tools at gmail dot com
2023-05-17 18:45 ` fweimer at redhat dot com
2023-05-17 20:16 ` hjl.tools at gmail dot com
2023-05-18 17:22 ` hjl.tools at gmail dot com
2023-06-30 17:43 ` cvs-commit at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).