about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-08-05 23:48:58 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-08-05 23:52:04 +0200
commit8c6beab4e1c03ac57150241015486e3f497c17cc (patch)
tree621433d7b20cfaace9183cb364e50dc686ac8623 /sysdeps/mach/hurd/i386
parentce625044886da0a6e348f4def83f746e28587a0c (diff)
downloadglibc-8c6beab4e1c03ac57150241015486e3f497c17cc.tar.gz
glibc-8c6beab4e1c03ac57150241015486e3f497c17cc.tar.xz
glibc-8c6beab4e1c03ac57150241015486e3f497c17cc.zip
hurd: Rework sbrk
Making the brk start exactly at the end of the main application binary was
requiring to get it through the _end symbol, which does not work any more
with recent toolchains, and actually produces in libc.so a confusing
external _end symbol that produces odd results, see
https://sourceware.org/bugzilla/show_bug.cgi?id=23499

Trying to do so is quite outdated anyway with the tendency for address
randomization.

Using _end was also allowing to include the main binary data within
the RLIMIT_DATA, but this also seems outdated with dynamic library
loading, and nowadays' memory consumption via malloc and mmap rather than
statically-allocated data.

This adds a BRK_START macro in <vm_param.h> that just tells where we
want to start the brk, and thus removes the _end symbol.

* sysdeps/mach/hurd/i386/vm_param.h: New file.
* sysdeps/mach/hurd/brk.c: Use BRK_START as brk start instead of _end.
Also ignore __data_start.
* hurd/Versions: Remove _end symbol.
* sysdeps/mach/hurd/i386/libc.abilist: Remove _end symbol.
Diffstat (limited to 'sysdeps/mach/hurd/i386')
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist1
-rw-r--r--sysdeps/mach/hurd/i386/vm_param.h24
2 files changed, 24 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 5f6154d518..72537218ba 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -554,7 +554,6 @@ GLIBC_2.2.6 __xstat64 F
 GLIBC_2.2.6 _authenticate F
 GLIBC_2.2.6 _dl_mcount_wrapper F
 GLIBC_2.2.6 _dl_mcount_wrapper_check F
-GLIBC_2.2.6 _end D 0x0
 GLIBC_2.2.6 _environ D 0x4
 GLIBC_2.2.6 _exit F
 GLIBC_2.2.6 _flushlbf F
diff --git a/sysdeps/mach/hurd/i386/vm_param.h b/sysdeps/mach/hurd/i386/vm_param.h
new file mode 100644
index 0000000000..96230bc149
--- /dev/null
+++ b/sysdeps/mach/hurd/i386/vm_param.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 2020 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/>.  */
+
+#ifndef _I386_VM_PARAM_H
+#define _I386_VM_PARAM_H
+
+/* Arbitrary start of the brk. This is after usual binary and library mappings.  */
+#define BRK_START	0x10000000
+
+#endif /* i386/vm_param.h */