public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix crash when tracing loaded objects
@ 2011-02-22 10:49 Andreas Schwab
  2011-03-06  7:19 ` Ulrich Drepper
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2011-02-22 10:49 UTC (permalink / raw)
  To: libc-hacker

$ LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=libs /lib64/ld-linux-x86-64.so.2 libm.so.6 
      4160:     find library=libm.so.6 [0]; searching
      4160:      search cache=/etc/ld.so.cache
      4160:       trying file=/lib64/libm.so.6
Segmentation fault

Andreas.

2011-02-22  Andreas Schwab  <schwab@redhat.com>

	* elf/dl-load.c (open_verify): Check for NULL loader even if
	SHARED.
	(_dl_map_object): Likewise.
---
 elf/dl-load.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 41b5ce7..e9e3876 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1,5 +1,5 @@
 /* Map in a shared object's segments from the file.
-   Copyright (C) 1995-2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 2007, 2009, 2010, 2011 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
@@ -1592,7 +1592,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 #ifdef SHARED
   /* Give the auditing libraries a chance.  */
   if (__builtin_expect (GLRO(dl_naudit) > 0, 0) && whatcode != 0
-      && loader->l_auditing == 0)
+      && loader != NULL && loader->l_auditing == 0)
     {
       struct audit_ifaces *afct = GLRO(dl_audit);
       for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
@@ -2010,7 +2010,7 @@ _dl_map_object (struct link_map *loader, const char *name,
   /* Give the auditing libraries a chance to change the name before we
      try anything.  */
   if (__builtin_expect (GLRO(dl_naudit) > 0, 0)
-      && (loader == NULL || loader->l_auditing == 0))
+      && loader != NULL && loader->l_auditing == 0)
     {
       struct audit_ifaces *afct = GLRO(dl_audit);
       for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
@@ -2116,12 +2116,8 @@ _dl_map_object (struct link_map *loader, const char *name,
 
 	      /* If the loader has the DF_1_NODEFLIB flag set we must not
 		 use a cache entry from any of these directories.  */
-	      if (
-#ifndef SHARED
-		  /* 'l' is always != NULL for dynamically linked objects.  */
-		  l != NULL &&
-#endif
-		  __builtin_expect (l->l_flags_1 & DF_1_NODEFLIB, 0))
+	      if (l != NULL
+		  && __builtin_expect (l->l_flags_1 & DF_1_NODEFLIB, 0))
 		{
 		  const char *dirp = system_dirs;
 		  unsigned int cnt = 0;
-- 
1.7.4


-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix crash when tracing loaded objects
  2011-02-22 10:49 [PATCH] Fix crash when tracing loaded objects Andreas Schwab
@ 2011-03-06  7:19 ` Ulrich Drepper
  2011-03-09 18:00   ` Ulrich Drepper
  2011-03-10 13:18   ` Ulrich Drepper
  0 siblings, 2 replies; 4+ messages in thread
From: Ulrich Drepper @ 2011-03-06  7:19 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

I checked in a better patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix crash when tracing loaded objects
  2011-03-06  7:19 ` Ulrich Drepper
@ 2011-03-09 18:00   ` Ulrich Drepper
  2011-03-10 13:18   ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2011-03-09 18:00 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

I checked in a better patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix crash when tracing loaded objects
  2011-03-06  7:19 ` Ulrich Drepper
  2011-03-09 18:00   ` Ulrich Drepper
@ 2011-03-10 13:18   ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2011-03-10 13:18 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

I checked in a better patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-06  7:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-22 10:49 [PATCH] Fix crash when tracing loaded objects Andreas Schwab
2011-03-06  7:19 ` Ulrich Drepper
2011-03-09 18:00   ` Ulrich Drepper
2011-03-10 13:18   ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).