我在 glibc 中看到一些奇怪的行为。该代码有一个错误,它会将随机指针传递给fclose()。我本来希望它此时会崩溃,但它会挂在pthread_once()中,并带有以下回溯。该程序不使用任何线程。
#0 0x000000318180ca38 in pthread_once () from /lib64/libpthread.so.0
#1 0x0000003181109d1c in backtrace () from /lib64/libc.so.6
#2 0x0000003181075d34 in __libc_message () from /lib64/libc.so.6
#3 0x000000318107c6fc in malloc_consolidate () from /lib64/libc.so.6
#4 0x000000318107d719 in _int_malloc () from /lib64/libc.so.6
#5 0x0000003181080a4a in calloc () from /lib64/libc.so.6
#6 0x0000003180c0b0df in _dl_new_object () from /lib64/ld-linux-x86-64.so.2
#7 0x0000003180c061ac in _dl_map_object_from_fd () from /lib64/ld-linux-x86-64.so.2
#8 0x0000003180c08563 in _dl_map_object () from /lib64/ld-linux-x86-64.so.2
#9 0x0000003180c13861 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
#10 0x0000003180c0f304 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#11 0x0000003180c131eb in _dl_open () from /lib64/ld-linux-x86-64.so.2
#12 0x00000031811305d2 in do_dlopen () from /lib64/libc.so.6
#13 0x0000003180c0f304 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#14 0x0000003181130692 in __libc_dlopen_mode () from /lib64/libc.so.6
#15 0x0000003181109c05 in init () from /lib64/libc.so.6
#16 0x000000318180ca40 in pthread_once () from /lib64/libpthread.so.0
#17 0x0000003181109d1c in backtrace () from /lib64/libc.so.6
#18 0x0000003181075d34 in __libc_message () from /lib64/libc.so.6
#19 0x000000318107d0b8 in _int_free () from /lib64/libc.so.6
#20 0x000000318106ba6d in fclose@@GLIBC_2.2.5 () from /lib64/libc.so.6
这是在带有glibc-2.17-20.fc19.x86_64的 Fedora 19 上,并且程序是从 systemd 启动的,因此__libc_message()StandardError=null
没有地方输出错误消息。
我已经修复了代码,但这是挂起 glibc 错误还是什么?