]> code.ossystems Code Review - openembedded-core.git/commitdiff
glibc & eglibc: fix mips DT_MIPS_RLD_MAP checking
authorQing He <qing.he@intel.com>
Sat, 25 Sep 2010 07:19:45 +0000 (15:19 +0800)
committerSaul Wold <Saul.Wold@intel.com>
Mon, 27 Sep 2010 15:59:16 +0000 (08:59 -0700)
On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic
section if a --version-script sets _RLD_MAP to local. This is apparently
a binutils bug, but libc shouldn't segfault in this case.

Add sanity check on the entry to avoid segfault, fixes [BUGID #287].

Signed-off-by: Qing He <qing.he@intel.com>
meta/recipes-core/eglibc/eglibc-2.12/mips-rld-map-check.patch [new file with mode: 0644]
meta/recipes-core/eglibc/eglibc_2.12.bb
meta/recipes-core/glibc/glibc-2.10.1/mips-rld-map-check.patch [new file with mode: 0644]
meta/recipes-core/glibc/glibc_2.10.1.bb

diff --git a/meta/recipes-core/eglibc/eglibc-2.12/mips-rld-map-check.patch b/meta/recipes-core/eglibc/eglibc-2.12/mips-rld-map-check.patch
new file mode 100644 (file)
index 0000000..ed08d7e
--- /dev/null
@@ -0,0 +1,21 @@
+On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic
+section if a --version-script sets _RLD_MAP to local. This is apparently
+a binutils bug, but libc shouldn't segfault in this case.
+
+see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615
+
+9/19/2010 - added by Qing He <qing.he@intel.com>
+---
+diff -ru glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h glibc-2.10.1/ports/sysdeps/mips/dl-machine.h
+--- glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h  2009-05-16 16:36:20.000000000 +0800
++++ glibc-2.10.1/ports/sysdeps/mips/dl-machine.h       2010-09-19 09:11:53.000000000 +0800
+@@ -70,7 +70,8 @@
+ /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
+    with the run-time address of the r_debug structure  */
+ #define ELF_MACHINE_DEBUG_SETUP(l,r) \
+-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
++do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \
++         (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \
+        *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
+        (ElfW(Addr)) (r); \
+    } while (0)
index 1b633a7d47226a6eaa485d8b2b5afd511816ac4e..7917fbdd7ff50d6c7c80c129075a3e2ada8c848f 100644 (file)
@@ -2,13 +2,14 @@ require eglibc.inc
 
 DEPENDS += "gperf-native"
 FILESPATHPKG =. "eglibc-svn:"
-PR = "r7"
+PR = "r8"
 SRCREV="10809"
 EGLIBC_BRANCH="eglibc-2_12"
 SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \
            file://eglibc-svn-arm-lowlevellock-include-tls.patch \
            file://IO-acquire-lock-fix.patch \
            file://shorten-build-commands.patch \
+           file://mips-rld-map-check.patch \
            file://etc/ld.so.conf \
            file://generate-supported.mk"
 S = "${WORKDIR}/${EGLIBC_BRANCH}/libc"
diff --git a/meta/recipes-core/glibc/glibc-2.10.1/mips-rld-map-check.patch b/meta/recipes-core/glibc/glibc-2.10.1/mips-rld-map-check.patch
new file mode 100644 (file)
index 0000000..ed08d7e
--- /dev/null
@@ -0,0 +1,21 @@
+On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic
+section if a --version-script sets _RLD_MAP to local. This is apparently
+a binutils bug, but libc shouldn't segfault in this case.
+
+see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615
+
+9/19/2010 - added by Qing He <qing.he@intel.com>
+---
+diff -ru glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h glibc-2.10.1/ports/sysdeps/mips/dl-machine.h
+--- glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h  2009-05-16 16:36:20.000000000 +0800
++++ glibc-2.10.1/ports/sysdeps/mips/dl-machine.h       2010-09-19 09:11:53.000000000 +0800
+@@ -70,7 +70,8 @@
+ /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
+    with the run-time address of the r_debug structure  */
+ #define ELF_MACHINE_DEBUG_SETUP(l,r) \
+-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
++do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \
++         (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \
+        *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
+        (ElfW(Addr)) (r); \
+    } while (0)
index 7f97273f70123c7eaec7890a65c68017f8fc3e7e..364a0e5d12805de111a2327773366ee2d75e7a52 100644 (file)
@@ -5,7 +5,7 @@ ARM_INSTRUCTION_SET = "arm"
 PACKAGES_DYNAMIC = "libc6*"
 RPROVIDES_${PN}-dev = "libc6-dev virtual-libc-dev"
 
-PR = "r5"
+PR = "r6"
 
 # the -isystem in bitbake.conf screws up glibc do_stage
 BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
@@ -54,6 +54,7 @@ SRC_URI = "ftp://ftp.gnu.org/pub/gnu/glibc/glibc-${PV}.tar.bz2 \
            file://glibc-check_pf.patch;striplevel=0 \
            file://ldd-unbash.patch \
            file://glibc-arm-IO-acquire-lock-fix.diff \
+           file://mips-rld-map-check.patch \
            file://generic-bits_select.h \
            file://generic-bits_types.h \
            file://generic-bits_typesizes.h \