From: Andreas Schwab <schwab@redhat.com>
To: libc-hacker@sourceware.org
Subject: [PATCH] Fix crash when tracing loaded objects
Date: Tue, 22 Feb 2011 10:49:00 -0000 [thread overview]
Message-ID: <m3oc64s5sf.fsf@redhat.com> (raw)
$ 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."
next reply other threads:[~2011-02-22 10:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 10:49 Andreas Schwab [this message]
2011-03-06 7:19 ` Ulrich Drepper
2011-03-09 18:00 ` Ulrich Drepper
2011-03-10 13:18 ` Ulrich Drepper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3oc64s5sf.fsf@redhat.com \
--to=schwab@redhat.com \
--cc=libc-hacker@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).