]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Skip audit if l_reloc_result is NULL
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 14 Nov 2012 23:44:40 +0000 (15:44 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 14 Nov 2012 23:44:40 +0000 (15:44 -0800)
ChangeLog
NEWS
elf/Makefile
elf/dl-runtime.c
elf/tst-audit8.c [new file with mode: 0644]

index f5a3645fb3ae5225a7dbcd38a690111695f1f85d..8014b6cb1652b1bf99f4064c8260183003a19fdf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-11-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #14831]
+       * elf/Makefile (tests): Add tst-audit8.
+       ($(objpfx)tst-audit8): Also depend on $(common-objpfx)math/libm.so.
+       ($(objpfx)tst-audit8.out): New target.
+       (tst-audit8-ENV): New variable.
+       * elf/dl-runtime.c (_dl_profile_fixup): Call _dl_fixup to skip
+       audit if l_reloc_result is NULL.
+       (ELF_MACHINE_RUNTIME_FIXUP_PARAMS): Issue an error if it isn't
+       defined and ELF_MACHINE_RUNTIME_FIXUP_ARGS is defined.
+       * elf/tst-audit8.c: New file.
+
 2012-11-14  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
 
        * io/Makefile (CFLAGS-open.c, CFLAGS-open64.c): Define.
diff --git a/NEWS b/NEWS
index 3ffdb8016870c86b35fa04b6058b5ef4796bff6a..0e76063ad3a361145909e6d9c26f684304ea0550 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,7 +19,7 @@ Version 2.17
   14562, 14568, 14576, 14579, 14583, 14587, 14595, 14602, 14610, 14621,
   14638, 14645, 14648, 14652, 14660, 14661, 14669, 14683, 14694, 14716,
   14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14805,
-  14807, 14809, 14811, 14815, 14821, 14824, 14838.
+  14807, 14809, 14811, 14815, 14821, 14824, 14831, 14838.
 
 * Port to ARM AArch64 contributed by Linaro.
 
index c2f0e2058fe239558d1b9f0672374f140fbbfcbc..7e5c9c87e968ddba983962abafdd2409b72ba3a5 100644 (file)
@@ -142,7 +142,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
         tst-dlmodcount tst-dlopenrpath tst-deep1 \
         tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
         unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
-        tst-audit1 tst-audit2 \
+        tst-audit1 tst-audit2 tst-audit8 \
         tst-stackguard1 tst-addr1 tst-thrlock \
         tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
         tst-initorder tst-initorder2 tst-relsort1
@@ -1020,6 +1020,10 @@ $(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
 $(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
 tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
 
+$(objpfx)tst-audit8: $(common-objpfx)math/libm.so
+$(objpfx)tst-audit8.out: $(objpfx)tst-auditmod1.so
+tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
+
 $(objpfx)tst-global1: $(libdl)
 $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
 
index 2e02a218e6b972a15a9c3f068b2bb3ae20d48351..7a3bc9ed9d8e4a47f3d9a7b72ec68af52a1ea994 100644 (file)
@@ -1,5 +1,5 @@
 /* On-demand PLT fixup for shared objects.
-   Copyright (C) 1995-2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 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
@@ -164,6 +164,26 @@ _dl_profile_fixup (
 {
   void (*mcount_fct) (ElfW(Addr), ElfW(Addr)) = INTUSE(_dl_mcount);
 
+  if (l->l_reloc_result == NULL)
+    {
+      /* BZ #14843: ELF_DYNAMIC_RELOCATE is called before l_reloc_result
+        is allocated.  We will get here if ELF_DYNAMIC_RELOCATE calls a
+        resolver function to resolve an IRELATIVE relocation and that
+        resolver calls a function that is not yet resolved (lazy).  For
+        example, the resolver in x86-64 libm.so calls __get_cpu_features
+        defined in libc.so.  Skip audit and resolve the external function
+        in this case.  */
+      *framesizep = -1;
+      return _dl_fixup (
+# ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
+#  ifndef ELF_MACHINE_RUNTIME_FIXUP_PARAMS
+#   error Please define ELF_MACHINE_RUNTIME_FIXUP_PARAMS.
+#  endif
+                       ELF_MACHINE_RUNTIME_FIXUP_PARAMS,
+# endif
+                       l, reloc_arg);
+    }
+
   /* This is the address in the array where we store the result of previous
      relocations.  */
   struct reloc_result *reloc_result = &l->l_reloc_result[reloc_index];
diff --git a/elf/tst-audit8.c b/elf/tst-audit8.c
new file mode 100644 (file)
index 0000000..63656b4
--- /dev/null
@@ -0,0 +1 @@
+#include "../io/pwd.c"