public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub
@ 2013-10-14 20:34 ppluzhnikov at google dot com
  2013-10-14 20:35 ` [Bug dynamic-link/16046] " ppluzhnikov at google dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2013-10-14 20:34 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16046

            Bug ID: 16046
           Summary: dl_iterate_phdr should not expose internal stub
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: ppluzhnikov at google dot com

Test case:

#define _GNU_SOURCE
#include <stdio.h>
#include <link.h>

int callback(struct dl_phdr_info *info, size_t size, void *data) {
  printf("addr=%p name=%s phdr=%p phnum=%d\n",
         (void*)info->dlpi_addr, info->dlpi_name, info->dlpi_phdr,
         info->dlpi_phnum);
  return 0;
}
int main() {
  int status;
  status = dl_iterate_phdr(callback, NULL);
  return 0;
}


Using current git trunk, dynamically linked binary shows:

addr=(nil) name= phdr=0x400040 phnum=9
addr=0x7fff2a613000 name=linux-vdso.so.1 phdr=0x7fff29d13040 phnum=4
addr=0x7f73a76d4000 name=./libc.so.6 phdr=0x7f73a76d4040 phnum=10
addr=0x7f73a7a87000 name=./elf/ld.so phdr=0x7f73a7a87040 phnum=7

Statically linked binary:

addr=(nil) name= phdr=0x400040 phnum=6
addr=(nil) name= phdr=(nil) phnum=0
addr=0x7ffffd5e1000 name=linux-vdso.so.1 phdr=0x7ffffcce1040 phnum=4

Same with glibc-2.15:
addr=(nil) name= phdr=0x400040 phnum=6


What is the second entry? People calling dl_iterate_phdr may legitimately
expect only real ELF images to appear.

At a minimum, this internal entry should be hidden from dl_iterate_phdr.

AFAICT, this was added in commit:

commit f91f1c0fb89056995f1c9c6a06c361efdf5139e7
Author: Maciej W. Rozycki <macro@codesourcery.com>
Date:   Fri Jun 28 16:20:26 2013 +0100

    [BZ #15022] Correct global-scope dlopen issues in static executables.

    This change creates a link map in static executables to serve as the
    global search list for dlopen.  It fixes a problem with the inability
    to access the global symbol object and a crash on an attempt to map a
    DSO into the global scope.  Some code that has become dead after the
    addition of this link map is removed too and test cases are provided.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug dynamic-link/16046] dl_iterate_phdr should not expose internal stub
  2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
@ 2013-10-14 20:35 ` ppluzhnikov at google dot com
  2014-01-31 18:03 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ppluzhnikov at google dot com @ 2013-10-14 20:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16046

Paul Pluzhnikov <ppluzhnikov at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dougkwan at google dot com,
                   |                            |macro@linux-mips.org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug dynamic-link/16046] dl_iterate_phdr should not expose internal stub
  2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
  2013-10-14 20:35 ` [Bug dynamic-link/16046] " ppluzhnikov at google dot com
@ 2014-01-31 18:03 ` cvs-commit at gcc dot gnu.org
  2014-01-31 18:08 ` macro@linux-mips.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-01-31 18:03 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=16046

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  0d23a5c1b1908700d25b7e3c6cece148e19dded4 (commit)
      from  0037bb6010522e20dde2da7922071d5cb53f67eb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0d23a5c1b1908700d25b7e3c6cece148e19dded4

commit 0d23a5c1b1908700d25b7e3c6cece148e19dded4
Author: Maciej W. Rozycki <macro@codesourcery.com>
Date:   Fri Jan 31 17:51:31 2014 +0000

    [BZ #16046] Static dlopen correction fallout fixes.

    Fixes to address issues from BZ #15022 resolution, as follows:

    * TLS updates to csu/libc-tls.c -- we now have a proper main map, so
      there's no longer a need to create a separate fake one to keep TLS
      structures,

    * random updates to elf/dl-close.c -- LM_ID_BASE is now a valid name
      space ID for static executables as well, so assert that we don't
      unload the main map.  Similarly dl_nns isn't supposed to be 0 for
      static executables anymore,

    * actual BZ #16046 fix to elf/dl-iteratephdr.c -- the dl_iterate_phdr
      special function for static executables isn't needed anymore, provided
      that l_phdr and l_phnum members of the main map have been properly
      initialized (done in _dl_non_dynamic_init in elf/dl-support.c now),

    * ld.so.cache loader update to elf/dl-load.c --
      GL(dl_ns)[LM_ID_BASE]._ns_loaded is now always initialized in static
      executables so can become the fallback loader map to check for
      DF_1_NODEFLIB, provided that the l_flags_1 member of the main map has
      been properly initialized (done in elf/dl-support.c now); this also
      ensures previous semantics elsewhere in elf/dl-load.c,

    * matching updates to elf/dl-support.c -- to complement the two fixes
      above.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |   16 ++++++++++++++++
 NEWS                 |   14 +++++++-------
 csu/libc-tls.c       |   27 ++++++++++++---------------
 elf/dl-close.c       |   10 +---------
 elf/dl-iteratephdr.c |   30 ------------------------------
 elf/dl-load.c        |   14 ++++----------
 elf/dl-support.c     |    3 +++
 7 files changed, 43 insertions(+), 71 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug dynamic-link/16046] dl_iterate_phdr should not expose internal stub
  2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
  2013-10-14 20:35 ` [Bug dynamic-link/16046] " ppluzhnikov at google dot com
  2014-01-31 18:03 ` cvs-commit at gcc dot gnu.org
@ 2014-01-31 18:08 ` macro@linux-mips.org
  2014-06-13  9:37 ` fweimer at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: macro@linux-mips.org @ 2014-01-31 18:08 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16046

Maciej W. Rozycki <macro@linux-mips.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Maciej W. Rozycki <macro@linux-mips.org> ---
Fixed as per the automatically entered commit message.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug dynamic-link/16046] dl_iterate_phdr should not expose internal stub
  2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
                   ` (2 preceding siblings ...)
  2014-01-31 18:08 ` macro@linux-mips.org
@ 2014-06-13  9:37 ` fweimer at redhat dot com
  2014-06-20 20:55 ` cvs-commit at gcc dot gnu.org
  2014-08-10 12:35 ` vapier at gentoo dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13  9:37 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16046

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug dynamic-link/16046] dl_iterate_phdr should not expose internal stub
  2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
                   ` (3 preceding siblings ...)
  2014-06-13  9:37 ` fweimer at redhat dot com
@ 2014-06-20 20:55 ` cvs-commit at gcc dot gnu.org
  2014-08-10 12:35 ` vapier at gentoo dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-06-20 20:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16046

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  257ce7127e2f64a6a959b146786cd43de0e42b5f (commit)
      from  4e6d234712f976eee62fb2047338a501da00c4c7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=257ce7127e2f64a6a959b146786cd43de0e42b5f

commit 257ce7127e2f64a6a959b146786cd43de0e42b5f
Author: Maciej W. Rozycki <macro@codesourcery.com>
Date:   Fri Jun 20 21:52:53 2014 +0100

    [BZ #16046] dl_iterate_phdr static executable test

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                        |    4 +++
 elf/Makefile                                     |    2 +-
 posix/tst-fnmatch3.c => elf/tst-dl-iter-static.c |   27 +++++++++++++++++----
 3 files changed, 27 insertions(+), 6 deletions(-)
 copy posix/tst-fnmatch3.c => elf/tst-dl-iter-static.c (65%)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug dynamic-link/16046] dl_iterate_phdr should not expose internal stub
  2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
                   ` (4 preceding siblings ...)
  2014-06-20 20:55 ` cvs-commit at gcc dot gnu.org
@ 2014-08-10 12:35 ` vapier at gentoo dot org
  5 siblings, 0 replies; 7+ messages in thread
From: vapier at gentoo dot org @ 2014-08-10 12:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16046

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=17250

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-08-10 12:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 20:34 [Bug dynamic-link/16046] New: dl_iterate_phdr should not expose internal stub ppluzhnikov at google dot com
2013-10-14 20:35 ` [Bug dynamic-link/16046] " ppluzhnikov at google dot com
2014-01-31 18:03 ` cvs-commit at gcc dot gnu.org
2014-01-31 18:08 ` macro@linux-mips.org
2014-06-13  9:37 ` fweimer at redhat dot com
2014-06-20 20:55 ` cvs-commit at gcc dot gnu.org
2014-08-10 12:35 ` vapier at gentoo dot org

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).