glibc/sysdeps
Sergey Bugaev 27cb2bb93d hurd: Implement MAP_EXCL
MAP_FIXED is defined to silently replace any existing mappings at the
address range being mapped over. This, however, is a dangerous, and only
rarely desired behavior.

Various Unix systems provide replacements or additions to MAP_FIXED:

* SerenityOS and Linux provide MAP_FIXED_NOREPLACE. If the address space
  already contains a mapping in the requested range, Linux returns
  EEXIST. SerenityOS returns ENOMEM, however that is a bug, as the
  MAP_FIXED_NOREPLACE implementation is intended to be compatible with
  Linux.

* FreeBSD provides the MAP_EXCL flag that has to be used in combination
  with MAP_FIXED. It returns EINVAL if the requested range already
  contains existing mappings. This is directly analogous to the O_EXCL
  flag in the open () call.

* DragonFly BSD, NetBSD, and OpenBSD provide MAP_TRYFIXED, but with
  different semantics. DragonFly BSD returns ENOMEM if the requested
  range already contains existing mappings. NetBSD does not return an
  error, but instead creates the mapping at a different address if the
  requested range contains mappings. OpenBSD behaves the same, but also
  notes that this is the default behavior even without MAP_TRYFIXED
  (which is the case on the Hurd too).

Since the Hurd leans closer to the BSD side, add MAP_EXCL as the primary
API to request the behavior of not replacing existing mappings. Declare
MAP_FIXED_NOREPLACE and MAP_TRYFIXED as aliases of (MAP_FIXED|MAP_EXCL),
so any existing software that checks for either of those macros will
pick them up automatically. For compatibility with Linux, return EEXIST
if a mapping already exists.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230625231751.404120-5-bugaevc@gmail.com>
2023-07-03 01:38:14 +02:00
..
aarch64 aarch64: Add vector implementations of exp routines 2023-06-30 09:04:26 +01:00
alpha Fix a few more typos I missed in previous round -- BZ 25337 2023-06-02 23:46:32 +00:00
arc Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
arm Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
csky Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
generic aarch64: Add vector implementations of cos routines 2023-06-30 09:04:10 +01:00
gnu Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
hppa Fix a few more typos I missed in previous round -- BZ 25337 2023-06-02 23:46:32 +00:00
htl Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
hurd hurd: Fix using interposable hurd_thread_self 2023-05-19 20:45:51 +02:00
i386 sysdeps/{i386, x86_64}/mempcpy_chk.S: fix linknamespace for __mempcpy_chk 2023-06-22 00:20:52 -04:00
ia64 Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
ieee754 aarch64: Add vector implementations of cos routines 2023-06-30 09:04:10 +01:00
loongarch LoongArch: Add support for dl_runtime_profile 2023-06-13 10:27:45 +08:00
m68k Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
mach hurd: Implement MAP_EXCL 2023-07-03 01:38:14 +02:00
microblaze Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
mips Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
nios2 Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
nptl Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
or1k Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
posix hurd: readv: Get rid of alloca 2023-06-20 19:15:10 +02:00
powerpc sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Fix warn unused result 2023-06-22 00:21:17 -04:00
pthread tests: replace read by xread 2023-06-19 09:14:56 -04:00
riscv Revert "riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC." 2023-05-07 14:16:03 +02:00
s390 Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
sh Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
sparc Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
unix hppa: xfail debug/tst-ssp-1 when have-ssp is yes (gcc-12 and later) 2023-07-01 18:26:18 +00:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
wordsize-64 hurd: Fix tst-writev test 2023-05-01 13:01:30 +02:00
x86 x86: Make dl-cache.h and readelflib.c not Linux-specific 2023-06-26 10:04:31 -03:00
x86_64 ld.so: Always use MAP_COPY to map the first segment [BZ #30452] 2023-06-30 10:42:42 -07:00