1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

hurd: Implement prefer_map_32bit_exec tunable

This makes the prefer_map_32bit_exec tunable no longer Linux-specific.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230423215526.346009-4-bugaevc@gmail.com>
This commit is contained in:
Sergey Bugaev
2023-04-24 00:55:26 +03:00
committed by Samuel Thibault
parent 35b7bf2fe0
commit c02b26455b
8 changed files with 33 additions and 23 deletions

View File

@ -1,25 +1,2 @@
# The default ABI is 64.
default-abi := 64
ifeq ($(subdir),elf)
tests-map-32bit = \
tst-map-32bit-1a \
tst-map-32bit-1b \
# tests-map-32bit
tst-map-32bit-1a-no-pie = yes
tst-map-32bit-1b-no-pie = yes
tests += $(tests-map-32bit)
modules-map-32bit = \
tst-map-32bit-mod \
# 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
endif

View File

@ -1,29 +0,0 @@
# x86-64 specific tunables.
# Copyright (C) 2023 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <https://www.gnu.org/licenses/>.
glibc {
cpu {
prefer_map_32bit_exec {
type: INT_32
minval: 0
maxval: 1
env_alias: LD_PREFER_MAP_32BIT_EXEC
security_level: SXID_IGNORE
}
}
}

View File

@ -1,34 +0,0 @@
/* Check that LD_PREFER_MAP_32BIT_EXEC works in PDE and shared library.
Copyright (C) 2023 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdint.h>
#include <support/check.h>
extern void dso_check_map_32bit (void);
static int
do_test (void)
{
printf ("do_test: %p\n", do_test);
TEST_VERIFY ((uintptr_t) do_test < 0xffffffffUL);
dso_check_map_32bit ();
return 0;
}
#include <support/test-driver.c>

View File

@ -1 +0,0 @@
#include "tst-map-32bit-1a.c"

View File

@ -1,33 +0,0 @@
/* Check that LD_PREFER_MAP_32BIT_EXEC works in shared library.
Copyright (C) 2023 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdint.h>
#include <support/check.h>
static void
dso_do_test (void)
{
}
void
dso_check_map_32bit (void)
{
printf ("dso_do_test: %p\n", dso_do_test);
TEST_VERIFY ((uintptr_t) dso_do_test < 0xffffffffUL);
}