public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27653] New: linux command will be deadlock when linked with libasan
@ 2021-03-26  6:45 hndxvon at 163 dot com
  2021-04-06 14:37 ` [Bug libc/27653] " schwab@linux-m68k.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: hndxvon at 163 dot com @ 2021-03-26  6:45 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 27653
           Summary: linux command will be deadlock when linked with
                    libasan
           Product: glibc
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: hndxvon at 163 dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---
              Host: arm64 Kunpeng920
             Build: Gcc-9.2 Glibc-2.30

Hello,
centos seems to be incompatible with libasan(8.0.1).
Run a linux command(like ps,free) with LD_PRELOAD envrionable variable on
centos aarch64 kunpeng920 (gcc-9.2/glibc-2.30), 
It will locked.

Run my scripts:
export ASAN_OPTIONS=detect_leaks=0:halt_on_error=0
export LD_LIBRARY_PATH=/usr/lib64/clang/8.0.1/lib/
export LD_PRELOAD=/lib64/clang/8.0.1/lib/libclang_rt.asan-aarch64.so
ps

------------------------------------------------------------------------
(gdb) bt
#0  0x0000ffffb244ecd8 in pthread_rwlock_wrlock () from /lib64/libpthread.so.0
#1  0x0000ffffb279501c in textdomain () from /lib64/libc.so.6
#2  0x0000ffffb29f72a0 in __interceptor_textdomain (domainname=0x40cab8
"procps-ng") at
../lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:413
#3  0x0000000000402b10 in main ()
(gdb) info threads
  Id   Target Id                              Frame
* 1    Thread 0xffffb2126480 (LWP 25205) "ps" 0x0000ffffb279501c in textdomain
() from /lib64/libc.so.6
There is only one thread. how could it generate deadlock?

But unset LD_PRELOAD, ps runs ok.
Try update compiler-rt to 10.0.0, this deadlock still exists.

Thank you for helping.

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

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

* [Bug libc/27653] linux command will be deadlock when linked with libasan
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
@ 2021-04-06 14:37 ` schwab@linux-m68k.org
  2021-08-12 20:17 ` mathieu.desnoyers at efficios dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: schwab@linux-m68k.org @ 2021-04-06 14:37 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |MOVED

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Please report that to the llvm project.  The ASAN runtime calls dlerror (which
uses gettext) during init, which causes a deadlock.

#0  __dcigettext (domainname=0xfffff73fb1e8 <_libc_intl_domainname> "libc", 
    msgid1=0xfffff3b01ea0 "undefined symbol: swift_demangle", 
    msgid2=msgid2@entry=0x0, plural=plural@entry=0, n=n@entry=0, 
    category=category@entry=5) at dcigettext.c:485
#1  0x0000fffff72f6068 in __GI___dcgettext (domainname=<optimized out>, 
    msgid=<optimized out>, category=category@entry=5) at dcgettext.c:47
#2  0x0000fffff7450b48 in __dlerror () at dlerror.c:102
#3  0x0000fffff7588ccc in AsanInitInternal ()
    at ../projects/compiler-rt/lib/asan/asan_rtl.cpp:521
#4  0x0000fffff7580698 in __interceptor_malloc ()
    at ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:144
#5  0x0000fffff72f5d58 in set_binding_values (
    domainname=0xfffff6c21290 "libgpg-error", dirnamep=0xffffffffefb8, 
    codesetp=0x0) at bindtextdom.c:202
#6  0x0000fffff72f5fcc in set_binding_values (codesetp=0x0, 
    dirnamep=0xffffffffefb8, domainname=<optimized out>) at bindtextdom.c:82
#7  __bindtextdomain (domainname=<optimized out>, dirname=<optimized out>)
    at bindtextdom.c:320
#8  0x0000fffff6c0c860 in gpg_err_init () from /usr/lib64/libgpg-error.so.0
#9  0x0000fffff7fcc630 in call_init (l=<optimized out>, argc=argc@entry=1, 
    argv=argv@entry=0xfffffffff068, env=env@entry=0xfffffffff078)
    at dl-init.c:74
#10 0x0000fffff7fcc72c in call_init (env=0xfffffffff078, argv=0xfffffffff068, 
    argc=1, l=<optimized out>) at dl-init.c:37
#11 _dl_init (main_map=0xfffff7fff280, argc=1, argv=0xfffffffff068, 
    env=0xfffffffff078) at dl-init.c:121
#12 0x0000fffff7fbee08 in _dl_start_user () from /lib/ld-linux-aarch64.so.1

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

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

* [Bug libc/27653] linux command will be deadlock when linked with libasan
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
  2021-04-06 14:37 ` [Bug libc/27653] " schwab@linux-m68k.org
@ 2021-08-12 20:17 ` mathieu.desnoyers at efficios dot com
  2021-08-12 20:23 ` [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy mathieu.desnoyers at efficios dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mathieu.desnoyers at efficios dot com @ 2021-08-12 20:17 UTC (permalink / raw)
  To: glibc-bugs

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

Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mathieu.desnoyers@efficios.
                   |                            |com
     Ever confirmed|0                           |1
         Resolution|MOVED                       |---
   Last reconfirmed|                            |2021-08-12
             Status|RESOLVED                    |REOPENED

--- Comment #2 from Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> ---
This bug was incorrectly triaged. The glibc i18n code uses non-recursive locks,
and causes issues when malloc interposers perform a i18n translation lookup.
This happens when dlsym() fails.

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
  2021-04-06 14:37 ` [Bug libc/27653] " schwab@linux-m68k.org
  2021-08-12 20:17 ` mathieu.desnoyers at efficios dot com
@ 2021-08-12 20:23 ` mathieu.desnoyers at efficios dot com
  2021-08-12 20:29 ` mathieu.desnoyers at efficios dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mathieu.desnoyers at efficios dot com @ 2021-08-12 20:23 UTC (permalink / raw)
  To: glibc-bugs

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

Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|linux command will be       |i18n causes deadlocks with
                   |deadlock when linked with   |malloc interposers due to
                   |libasan                     |missing reentrancy

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (2 preceding siblings ...)
  2021-08-12 20:23 ` [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy mathieu.desnoyers at efficios dot com
@ 2021-08-12 20:29 ` mathieu.desnoyers at efficios dot com
  2021-08-12 20:30 ` mathieu.desnoyers at efficios dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mathieu.desnoyers at efficios dot com @ 2021-08-12 20:29 UTC (permalink / raw)
  To: glibc-bugs

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

Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=90589

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (3 preceding siblings ...)
  2021-08-12 20:29 ` mathieu.desnoyers at efficios dot com
@ 2021-08-12 20:30 ` mathieu.desnoyers at efficios dot com
  2021-08-12 20:37 ` francis.deslauriers at efficios dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mathieu.desnoyers at efficios dot com @ 2021-08-12 20:30 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> ---
I have provided a RFC patch against glibc which solves this issue:
https://sourceware.org/pipermail/libc-alpha/2021-August/130129.html

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (4 preceding siblings ...)
  2021-08-12 20:30 ` mathieu.desnoyers at efficios dot com
@ 2021-08-12 20:37 ` francis.deslauriers at efficios dot com
  2021-08-13 14:40 ` mathieu.desnoyers at efficios dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: francis.deslauriers at efficios dot com @ 2021-08-12 20:37 UTC (permalink / raw)
  To: glibc-bugs

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

francis.deslauriers at efficios dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |francis.deslauriers@efficio
                   |                            |s.com

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (5 preceding siblings ...)
  2021-08-12 20:37 ` francis.deslauriers at efficios dot com
@ 2021-08-13 14:40 ` mathieu.desnoyers at efficios dot com
  2021-08-30  3:29 ` hndxvon at 163 dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mathieu.desnoyers at efficios dot com @ 2021-08-13 14:40 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #4 from Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> ---
Created attachment 13617
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13617&action=edit
Interceptor library working-around glibc's intl issues for malloc interceptors

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (6 preceding siblings ...)
  2021-08-13 14:40 ` mathieu.desnoyers at efficios dot com
@ 2021-08-30  3:29 ` hndxvon at 163 dot com
  2021-08-30 14:09 ` mathieu.desnoyers at efficios dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: hndxvon at 163 dot com @ 2021-08-30  3:29 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from Haishan <hndxvon at 163 dot com> ---
   thank you. this patch works for me. so this patch will upstream to
   glibc github?

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (7 preceding siblings ...)
  2021-08-30  3:29 ` hndxvon at 163 dot com
@ 2021-08-30 14:09 ` mathieu.desnoyers at efficios dot com
  2022-03-04 13:16 ` vincent-srcware at vinc17 dot net
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mathieu.desnoyers at efficios dot com @ 2021-08-30 14:09 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #6 from Mathieu Desnoyers <mathieu.desnoyers at efficios dot com> ---
(In reply to Haishan from comment #5)
>    thank you. this patch works for me. so this patch will upstream to
>    glibc github?

Just to confirm, did you test the interceptor library work-around or the glibc
fix I submitted here:
https://sourceware.org/pipermail/libc-alpha/2021-August/130129.html ?

About the glibc fix, the mailing list discussion is ongoing with the glibc
maintainers.

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (8 preceding siblings ...)
  2021-08-30 14:09 ` mathieu.desnoyers at efficios dot com
@ 2022-03-04 13:16 ` vincent-srcware at vinc17 dot net
  2022-03-04 13:26 ` vincent-srcware at vinc17 dot net
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: vincent-srcware at vinc17 dot net @ 2022-03-04 13:16 UTC (permalink / raw)
  To: glibc-bugs

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

Vincent Lefèvre <vincent-srcware at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent-srcware at vinc17 dot net

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (9 preceding siblings ...)
  2022-03-04 13:16 ` vincent-srcware at vinc17 dot net
@ 2022-03-04 13:26 ` vincent-srcware at vinc17 dot net
  2022-07-18  9:32 ` jeanmichael.celerier at gmail dot com
  2022-07-18  9:50 ` jeanmichael.celerier at gmail dot com
  12 siblings, 0 replies; 14+ messages in thread
From: vincent-srcware at vinc17 dot net @ 2022-03-04 13:26 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #7 from Vincent Lefèvre <vincent-srcware at vinc17 dot net> ---
Under Debian/unstable (Debian package libc6 2.33-7), when running some
executables with LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6, I can also
see this issue. The gdb backtrace shows __futex_abstimed_wait_common64 /
__GI___futex_abstimed_wait64 / __pthread_rwlock_wrlock_full64 /
__GI___pthread_rwlock_wrlock / set_binding_values in each case.

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (10 preceding siblings ...)
  2022-03-04 13:26 ` vincent-srcware at vinc17 dot net
@ 2022-07-18  9:32 ` jeanmichael.celerier at gmail dot com
  2022-07-18  9:50 ` jeanmichael.celerier at gmail dot com
  12 siblings, 0 replies; 14+ messages in thread
From: jeanmichael.celerier at gmail dot com @ 2022-07-18  9:32 UTC (permalink / raw)
  To: glibc-bugs

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

Jean-Michaël Celerier <jeanmichael.celerier at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jeanmichael.celerier@gmail.
                   |                            |com

--- Comment #8 from Jean-Michaël Celerier <jeanmichael.celerier at gmail dot com> ---
Same issue here, glibc 2.35-6 and clang 14. I tried the interposer library fix
but couldn't make it work - for some reason whichever libasan.so I try to
preload I get issues:


   
LD_PRELOAD=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/libasan.so:/home/jcelerier/libasan-glibc-fix.so
./ossia-score
    ==19609==Your application is linked against incompatible ASan runtimes.

    
LD_PRELOAD=/usr/lib/clang/14.0.6/lib/linux/libclang_rt.asan-x86_64.so:/home/jcelerier/libasan-glibc-fix.so
./ossia-score 
    ==19481==Your application is linked against incompatible ASan runtimes.


If I don't add the asan runtime I still get the hang..

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

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

* [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy
  2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
                   ` (11 preceding siblings ...)
  2022-07-18  9:32 ` jeanmichael.celerier at gmail dot com
@ 2022-07-18  9:50 ` jeanmichael.celerier at gmail dot com
  12 siblings, 0 replies; 14+ messages in thread
From: jeanmichael.celerier at gmail dot com @ 2022-07-18  9:50 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #9 from Jean-Michaël Celerier <jeanmichael.celerier at gmail dot com> ---
The extremely aggressive option of forcibly interposing a

    char* dlerror(void) { return ""; }

does work, though

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

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

end of thread, other threads:[~2022-07-18  9:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  6:45 [Bug libc/27653] New: linux command will be deadlock when linked with libasan hndxvon at 163 dot com
2021-04-06 14:37 ` [Bug libc/27653] " schwab@linux-m68k.org
2021-08-12 20:17 ` mathieu.desnoyers at efficios dot com
2021-08-12 20:23 ` [Bug libc/27653] i18n causes deadlocks with malloc interposers due to missing reentrancy mathieu.desnoyers at efficios dot com
2021-08-12 20:29 ` mathieu.desnoyers at efficios dot com
2021-08-12 20:30 ` mathieu.desnoyers at efficios dot com
2021-08-12 20:37 ` francis.deslauriers at efficios dot com
2021-08-13 14:40 ` mathieu.desnoyers at efficios dot com
2021-08-30  3:29 ` hndxvon at 163 dot com
2021-08-30 14:09 ` mathieu.desnoyers at efficios dot com
2022-03-04 13:16 ` vincent-srcware at vinc17 dot net
2022-03-04 13:26 ` vincent-srcware at vinc17 dot net
2022-07-18  9:32 ` jeanmichael.celerier at gmail dot com
2022-07-18  9:50 ` jeanmichael.celerier at gmail 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).