mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
6259ab3941
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.
30 lines
873 B
Makefile
30 lines
873 B
Makefile
ifeq ($(subdir),elf)
|
|
|
|
tests-map-32bit = \
|
|
tst-map-32bit-1a \
|
|
tst-map-32bit-1b \
|
|
tst-map-32bit-2 \
|
|
# tests-map-32bit
|
|
tst-map-32bit-1a-no-pie = yes
|
|
tst-map-32bit-1b-no-pie = yes
|
|
tst-map-32bit-2-no-pie = yes
|
|
tests += $(tests-map-32bit)
|
|
|
|
modules-map-32bit = \
|
|
tst-map-32bit-mod \
|
|
tst-map-32bit-mod-2 \
|
|
# modules-map-32bit
|
|
modules-names += $(modules-map-32bit)
|
|
|
|
$(objpfx)tst-map-32bit-mod.so: $(libsupport)
|
|
tst-map-32bit-1a-ENV = LD_PREFER_MAP_32BIT_EXEC=1
|
|
$(objpfx)tst-map-32bit-1a: $(objpfx)tst-map-32bit-mod.so
|
|
tst-map-32bit-1b-ENV = GLIBC_TUNABLES=glibc.cpu.prefer_map_32bit_exec=1
|
|
$(objpfx)tst-map-32bit-1b: $(objpfx)tst-map-32bit-mod.so
|
|
LDFLAGS-tst-map-32bit-mod-2.so += -Wl,-z,max-page-size=0x200000
|
|
$(objpfx)tst-map-32bit-mod-2.so: $(libsupport)
|
|
tst-map-32bit-2-ENV = LD_PREFER_MAP_32BIT_EXEC=1
|
|
$(objpfx)tst-map-32bit-2: $(objpfx)tst-map-32bit-mod-2.so
|
|
|
|
endif
|