public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/29567] New: when `dlopen` glibc itself, it needs `__ctype_init`
@ 2022-09-13  8:17 linjy0410 at gmail dot com
  2022-09-13  9:04 ` [Bug dynamic-link/29567] " fweimer at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: linjy0410 at gmail dot com @ 2022-09-13  8:17 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 29567
           Summary: when `dlopen` glibc itself, it needs `__ctype_init`
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: linjy0410 at gmail dot com
  Target Milestone: ---

We met an issue that while `dlopen("libc.so.6")` and using dlsym to call the
functions inside, some will crash because of ctype TLS is not initialized, e.g.
`iconv` that uses `isspace` which would access ctype.
By manual dlsym and calling `__ctype_init`, it can work normally.
I'm not sure whether this is a bug or dlopen a glibc is not intended.

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

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

* [Bug dynamic-link/29567] when `dlopen` glibc itself, it needs `__ctype_init`
  2022-09-13  8:17 [Bug dynamic-link/29567] New: when `dlopen` glibc itself, it needs `__ctype_init` linjy0410 at gmail dot com
@ 2022-09-13  9:04 ` fweimer at redhat dot com
  2022-09-14  5:28 ` linjy0410 at gmail dot com
  2022-09-14  7:03 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2022-09-13  9:04 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-09-13
                 CC|                            |fweimer at redhat dot com
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Could you share a reproducer, please? Does it involve static dlopen? Thanks.

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

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

* [Bug dynamic-link/29567] when `dlopen` glibc itself, it needs `__ctype_init`
  2022-09-13  8:17 [Bug dynamic-link/29567] New: when `dlopen` glibc itself, it needs `__ctype_init` linjy0410 at gmail dot com
  2022-09-13  9:04 ` [Bug dynamic-link/29567] " fweimer at redhat dot com
@ 2022-09-14  5:28 ` linjy0410 at gmail dot com
  2022-09-14  7:03 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: linjy0410 at gmail dot com @ 2022-09-14  5:28 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from jy l <linjy0410 at gmail dot com> ---
Created attachment 14334
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14334&action=edit
iconv_open segfault poc

I pull the latest glibc and build/install it to `glibcinstallamd64`, with gcc
9.4.0.
And compile this poc by `gcc poc.c -ldl` with my system libc which is 2.31.
It segfault on my machine when calling the `func` (iconv_open), didn't have any
static dlopen I think.

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

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

* [Bug dynamic-link/29567] when `dlopen` glibc itself, it needs `__ctype_init`
  2022-09-13  8:17 [Bug dynamic-link/29567] New: when `dlopen` glibc itself, it needs `__ctype_init` linjy0410 at gmail dot com
  2022-09-13  9:04 ` [Bug dynamic-link/29567] " fweimer at redhat dot com
  2022-09-14  5:28 ` linjy0410 at gmail dot com
@ 2022-09-14  7:03 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2022-09-14  7:03 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
I'm afraid this is expected: the dynamic loader from the system libc is not
able to load libc.so.6 from the version you just built. Dynamic loader and
libc.so.6 must come from the exact same build.

You need to run your application with the new dynamic loader, too. Use an
explicit ld.so invocation (see the testrun.sh in the build tree for an
example), or set the loader with the -Wl,--dynamic-linker= option. You may also
have to link to the new glibc startup files,
<https://sourceware.org/glibc/wiki/Testing/Builds#Build100PctNew> has the
details.

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

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13  8:17 [Bug dynamic-link/29567] New: when `dlopen` glibc itself, it needs `__ctype_init` linjy0410 at gmail dot com
2022-09-13  9:04 ` [Bug dynamic-link/29567] " fweimer at redhat dot com
2022-09-14  5:28 ` linjy0410 at gmail dot com
2022-09-14  7:03 ` fweimer at redhat dot com

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