This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Always set l_used for vDSO (BZ #13706)


On Mon, Feb 20, 2012 at 11:11:35AM -0500, Carlos O'Donell wrote:
Can you please add a regression test for this?

Here's an attempt. Looks like it works fine. But, please, somebody look
at the Makefile changes as I don't know all the ins and outs yet.


Ok (with appropriate NEWS entry)? Thanks,

2012-02-24 Marek Polacek <polacek@redhat.com>

	[BZ #13706]
	* elf/rtld.c (dl_main): Always set l_used to 1 for vDSO.
	* elf/Makefile: Add rules to run tst-unused-dep.out.

--- libc/elf/Makefile.mp	2012-02-23 14:24:05.292652999 +0100
+++ libc/elf/Makefile	2012-02-24 10:12:56.953287728 +0100
@@ -1203,3 +1203,13 @@ $(objpfx)tst-relsort1mod1.so: $(libm) $(
$(objpfx)tst-relsort1mod2.so: $(libm)
$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
			   $(objpfx)tst-relsort1mod2.so
+
+tests: $(objpfx)tst-unused-dep.out
+
+$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
+	LD_TRACE_LOADED_OBJECTS=1 \
+	LD_DEBUG=unused \
+	$(elf-objpfx)${rtld-installed-name} \
+	  --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+	  $< | grep -E "linux-(gate|vdso).so.1" > $@ || :
+	cmp $@ /dev/null > /dev/null
--- libc/elf/rtld.c.mp	2012-02-20 10:03:06.799226404 +0100
+++ libc/elf/rtld.c	2012-02-24 11:05:35.047046172 +0100
@@ -1,5 +1,5 @@
/* Run time dynamic linker.
-   Copyright (C) 1995-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
@@ -1375,6 +1375,9 @@ of this helper program; chances are you
	  _dl_setup_hash (l);
	  l->l_relocated = 1;

+	  /* The vDSO is always used.  */
+	  l->l_used = 1;
+
	  /* Initialize l_local_scope to contain just this map.  This allows
	     the use of dl_lookup_symbol_x to resolve symbols within the vdso.
	     So we create a single entry list pointing to l_real as its only

Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]