[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r5495 - in glibc-package/branches/eglibc-2.17/debian: . patches patches/hurd-i386



Author: sthibault
Date: 2013-02-24 16:36:50 +0000 (Sun, 24 Feb 2013)
New Revision: 5495

Added:
   glibc-package/branches/eglibc-2.17/debian/patches/hurd-i386/tg-pie-sbrk.diff
Modified:
   glibc-package/branches/eglibc-2.17/debian/changelog
   glibc-package/branches/eglibc-2.17/debian/patches/series
Log:
forward-port 5489 and 5490 from trunk

Modified: glibc-package/branches/eglibc-2.17/debian/changelog
===================================================================
--- glibc-package/branches/eglibc-2.17/debian/changelog	2013-02-24 14:41:18 UTC (rev 5494)
+++ glibc-package/branches/eglibc-2.17/debian/changelog	2013-02-24 16:36:50 UTC (rev 5495)
@@ -611,6 +611,8 @@
   * patches/hurd-i386/unsubmitted-select-EINTR.diff: Fix select vs signals.
   * patches/hurd-i386/cvs-libpthread_lock.diff: Fix file lock primitives
     version to fix stdio thread-safety.
+  * patches/hurd-i386/tg-pie-sbrk.diff: Fix sbrk() use in PIE binaries (e.g.
+    libgc, perl).
 
   [ Adam Conrad ]
   * debian/testsuite-checking/compare.sh: Disable failing the build on test

Copied: glibc-package/branches/eglibc-2.17/debian/patches/hurd-i386/tg-pie-sbrk.diff (from rev 5489, glibc-package/trunk/debian/patches/hurd-i386/tg-pie-sbrk.diff)
===================================================================
--- glibc-package/branches/eglibc-2.17/debian/patches/hurd-i386/tg-pie-sbrk.diff	                        (rev 0)
+++ glibc-package/branches/eglibc-2.17/debian/patches/hurd-i386/tg-pie-sbrk.diff	2013-02-24 16:36:50 UTC (rev 5495)
@@ -0,0 +1,34 @@
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Subject: Fix sbrk in PIE binaries
+
+In PIE mode, the program gets loaded at very low address, and thus _end is very
+low, just before libraries, and thus initializing the brk to it does not make
+sense, since there is no room left there. Hardcode the brk to 0x8000000 for now
+as a workaround.
+
+Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+---
+ sysdeps/mach/hurd/brk.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
+index 1900277..fb74e83 100644
+--- a/sysdeps/mach/hurd/brk.c
++++ b/sysdeps/mach/hurd/brk.c
+@@ -143,8 +143,12 @@ init_brk (void)
+   /* If _hurd_brk is already set, don't change it.  The assumption is that
+      it was set in a previous run before something like Emacs's unexec was
+      called and dumped all the data up to the break at that point.  */
+-  if (_hurd_brk == 0)
++  if (_hurd_brk == 0) {
+     _hurd_brk = (vm_address_t) &_end;
++    if (_hurd_brk < 0x8000000)
++      /* XXX: PIE case, get out of library area */
++      _hurd_brk = 0x8000000;
++  }
+ 
+   pagend = round_page (_hurd_brk);
+ 
+-- 
+tg: (4a7fa7e..) t/pie-sbrk (depends on: baseline)

Modified: glibc-package/branches/eglibc-2.17/debian/patches/series
===================================================================
--- glibc-package/branches/eglibc-2.17/debian/patches/series	2013-02-24 14:41:18 UTC (rev 5494)
+++ glibc-package/branches/eglibc-2.17/debian/patches/series	2013-02-24 16:36:50 UTC (rev 5495)
@@ -112,6 +112,7 @@
 hurd-i386/tg-setitimer.diff
 hurd-i386/tg-select-EINTR.diff
 hurd-i386/cvs-libpthread_lock.diff
+hurd-i386/tg-pie-sbrk.diff
 hurd-i386/tg-ifaddrs_v6.diff
 
 i386/local-biarch.diff


Reply to: