public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen
@ 2022-08-26 11:22 fweimer at redhat dot com
  2022-08-26 11:22 ` [Bug dynamic-link/29528] " fweimer at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-08-26 11:22 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 29528
           Summary: __libc_early_init not called after dlmopen
           Product: glibc
           Version: 2.37
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---
             Flags: security-

The libc_map member of the namespace is never set to NULL after the namespace
has been used. This means that dlmopen/dlclose/dlmopen sequence results in an
inner libc that is not initialized correctly. The most obvious problem is that
<ctype.h> functions such as isalpha crash.

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
@ 2022-08-26 11:22 ` fweimer at redhat dot com
  2022-08-26 11:26 ` [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace fweimer at redhat dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-08-26 11:22 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
           Assignee|unassigned at sourceware dot org   |fweimer at redhat dot com
             Status|NEW                         |ASSIGNED

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
  2022-08-26 11:22 ` [Bug dynamic-link/29528] " fweimer at redhat dot com
@ 2022-08-26 11:26 ` fweimer at redhat dot com
  2022-08-26 13:52 ` fweimer at redhat dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-08-26 11:26 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__libc_early_init not       |__libc_early_init not
                   |called after dlmopen        |called after dlmopen that
                   |                            |reuses namespace

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
  2022-08-26 11:22 ` [Bug dynamic-link/29528] " fweimer at redhat dot com
  2022-08-26 11:26 ` [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace fweimer at redhat dot com
@ 2022-08-26 13:52 ` fweimer at redhat dot com
  2022-08-26 19:45 ` fweimer at redhat dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-08-26 13:52 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Patch posted:

[PATCH] elf: Call __libc_early_init for reused namespaces (bug 29528)
<https://sourceware.org/pipermail/libc-alpha/2022-August/141696.html>

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (2 preceding siblings ...)
  2022-08-26 13:52 ` fweimer at redhat dot com
@ 2022-08-26 19:45 ` fweimer at redhat dot com
  2022-08-29 13:47 ` fweimer at redhat dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-08-26 19:45 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.37
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #2 from Florian Weimer <fweimer at redhat dot com> ---
Fixed via:

commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Aug 26 21:15:43 2022 +0200

    elf: Call __libc_early_init for reused namespaces (bug 29528)

    libc_map is never reset to NULL, neither during dlclose nor on a
    dlopen call which reuses the namespace structure.  As a result, if a
    namespace is reused, its libc is not initialized properly.  The most
    visible result is a crash in the <ctype.h> functions.

    To prevent similar bugs on namespace reuse from surfacing,
    unconditionally initialize the chosen namespace to zero using memset.

I'm going to backport this all the way to 2.34.

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (3 preceding siblings ...)
  2022-08-26 19:45 ` fweimer at redhat dot com
@ 2022-08-29 13:47 ` fweimer at redhat dot com
  2022-09-22 14:39 ` al_95 at outlook dot it
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-08-29 13:47 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugzilla.redhat.com
                   |                            |/show_bug.cgi?id=2121746

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (4 preceding siblings ...)
  2022-08-29 13:47 ` fweimer at redhat dot com
@ 2022-09-22 14:39 ` al_95 at outlook dot it
  2022-09-22 14:58 ` fweimer at redhat dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: al_95 at outlook dot it @ 2022-09-22 14:39 UTC (permalink / raw)
  To: glibc-bugs

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

A.L. <al_95 at outlook dot it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |al_95 at outlook dot it

--- Comment #3 from A.L. <al_95 at outlook dot it> ---
Applying this patch makes dlmopen occasionally hang.
I reported it in bug 29600.

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (5 preceding siblings ...)
  2022-09-22 14:39 ` al_95 at outlook dot it
@ 2022-09-22 14:58 ` fweimer at redhat dot com
  2022-10-14  9:02 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2022-09-22 14:58 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

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

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (6 preceding siblings ...)
  2022-09-22 14:58 ` fweimer at redhat dot com
@ 2022-10-14  9:02 ` cvs-commit at gcc dot gnu.org
  2022-10-14  9:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-14  9:02 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Florian Weimer <fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2c42257314536b94cc8d52edede86e94e98c1436

commit 2c42257314536b94cc8d52edede86e94e98c1436
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Oct 14 11:02:25 2022 +0200

    elf: Do not completely clear reused namespace in dlmopen (bug 29600)

    The data in the _ns_debug member must be preserved, otherwise
    _dl_debug_initialize enters an infinite loop.  To be conservative,
    only clear the libc_map member for now, to fix bug 29528.

    Fixes commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe
    ("elf: Call __libc_early_init for reused namespaces (bug 29528)"),
    by reverting most of it.

    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (7 preceding siblings ...)
  2022-10-14  9:02 ` cvs-commit at gcc dot gnu.org
@ 2022-10-14  9:29 ` cvs-commit at gcc dot gnu.org
  2022-10-14 10:37 ` cvs-commit at gcc dot gnu.org
  2022-10-14 11:03 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-14  9:29 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.36/master branch has been updated by Florian Weimer
<fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=19535f3b57306ea3ec559a6c0b10d2d7a87418a7

commit 19535f3b57306ea3ec559a6c0b10d2d7a87418a7
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Oct 14 11:02:25 2022 +0200

    elf: Do not completely clear reused namespace in dlmopen (bug 29600)

    The data in the _ns_debug member must be preserved, otherwise
    _dl_debug_initialize enters an infinite loop.  To be conservative,
    only clear the libc_map member for now, to fix bug 29528.

    Fixes commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe
    ("elf: Call __libc_early_init for reused namespaces (bug 29528)"),
    by reverting most of it.

    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 2c42257314536b94cc8d52edede86e94e98c1436)

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (8 preceding siblings ...)
  2022-10-14  9:29 ` cvs-commit at gcc dot gnu.org
@ 2022-10-14 10:37 ` cvs-commit at gcc dot gnu.org
  2022-10-14 11:03 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-14 10:37 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.35/master branch has been updated by Florian Weimer
<fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8d125a1f9145ad90c94e438858d6b5b7578686f2

commit 8d125a1f9145ad90c94e438858d6b5b7578686f2
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Oct 14 11:02:25 2022 +0200

    elf: Do not completely clear reused namespace in dlmopen (bug 29600)

    The data in the _ns_debug member must be preserved, otherwise
    _dl_debug_initialize enters an infinite loop.  To be conservative,
    only clear the libc_map member for now, to fix bug 29528.

    Fixes commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe
    ("elf: Call __libc_early_init for reused namespaces (bug 29528)"),
    by reverting most of it.

    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 2c42257314536b94cc8d52edede86e94e98c1436)

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

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

* [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace
  2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
                   ` (9 preceding siblings ...)
  2022-10-14 10:37 ` cvs-commit at gcc dot gnu.org
@ 2022-10-14 11:03 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-14 11:03 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.34/master branch has been updated by Florian Weimer
<fw@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9f55d2e7c42e6ca862a25d3ee3eb2b367811c30d

commit 9f55d2e7c42e6ca862a25d3ee3eb2b367811c30d
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Oct 14 12:43:07 2022 +0200

    elf: Do not completely clear reused namespace in dlmopen (bug 29600)

    The data in the _ns_debug member must be preserved, otherwise
    _dl_debug_initialize enters an infinite loop.  To be conservative,
    only clear the libc_map member for now, to fix bug 29528.

    Fixes commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe
    ("elf: Call __libc_early_init for reused namespaces (bug 29528)"),
    by reverting most of it.

    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>
    (cherry picked from commit 2c42257314536b94cc8d52edede86e94e98c1436)
    (Conflict in elf/dl-open.c due to missing _r_debug namespace support.)

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

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

end of thread, other threads:[~2022-10-14 11:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 11:22 [Bug dynamic-link/29528] New: __libc_early_init not called after dlmopen fweimer at redhat dot com
2022-08-26 11:22 ` [Bug dynamic-link/29528] " fweimer at redhat dot com
2022-08-26 11:26 ` [Bug dynamic-link/29528] __libc_early_init not called after dlmopen that reuses namespace fweimer at redhat dot com
2022-08-26 13:52 ` fweimer at redhat dot com
2022-08-26 19:45 ` fweimer at redhat dot com
2022-08-29 13:47 ` fweimer at redhat dot com
2022-09-22 14:39 ` al_95 at outlook dot it
2022-09-22 14:58 ` fweimer at redhat dot com
2022-10-14  9:02 ` cvs-commit at gcc dot gnu.org
2022-10-14  9:29 ` cvs-commit at gcc dot gnu.org
2022-10-14 10:37 ` cvs-commit at gcc dot gnu.org
2022-10-14 11:03 ` cvs-commit at gcc dot gnu.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).