Closed PAStheLoD closed 1 month ago
curl
is a statically linked program, so it shouldn't load /etc/ld.so.cache
.
I checked kernels 5.15, 6.8, and 6.11 on Ubuntu 22.04, and they never load /etc/ld.so.cache
.
Could you show me the result of ldd ./glibc/curl
?
Hello,
Yes of course.
/opt/curl-http3/glibc# ./curl
Floating point exception (core dumped)
/opt/curl-http3/glibc# ldd ./curl
not a dynamic executable
/opt/curl-http3/glibc# file curl
curl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=c2de21ff7b244331dda32053f3b6a33c13e99ab1, for GNU/Linux 3.2.0, stripped
Many thanks for the fast response!
Interestingly trurl runs. (Well sort of, but probably this is a bug, as both versions crash. Maybe a double-free.)
/opt/curl-http3/glibc# ./trurl 'https://example.com/aa?a/b"'
https://example.com/aa?a%2fb%22
# ./trurl 'https://example.com/aa?a/b"=aaa'
https://example.com/aa?a%2fb%22=aaa
free(): invalid pointer
Aborted (core dumped)
/opt/curl-http3/musl# ./trurl 'https://example.com/aa?a/b"=aaa'
https://example.com/aa?a%2fb%22=aaa
Segmentation fault (core dumped)
/etc/nsswitch.conf
/etc/ld.so.conf
And all files in directory /etc/ld.so.conf.d/
1.
# echo " ___ $LD_PRELOAD __ $LD_LIBRARY_PATH ___"
___ __ ___
# ( set -o posix ; set ) | grep LD_
#
# env | grep LD_
#
They should be unset (and they appear to be).
2.
# cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat systemd
group: compat systemd
shadow: compat
gshadow: files
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
(I tried removing systemd from nsswitch.conf, it seems to have made no difference.)
# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
# find /etc/ld.so.conf.d/ -type f
/etc/ld.so.conf.d/x86_64-linux-gnu.conf
/etc/ld.so.conf.d/libc.conf
# find /etc/ld.so.conf.d/ -type f -exec echo -e "\n\n---" {} "---" \; -exec cat {} \;
--- /etc/ld.so.conf.d/x86_64-linux-gnu.conf ---
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
--- /etc/ld.so.conf.d/libc.conf ---
# libc default configuration
/usr/local/lib
It seems like everything is fine, but I have no idea why it loads libnss_compat.so.2
, libc.so.6
, and ld-linux-x86-64.so.2
.
There is also a similar issue, #62.
If the cause cannot be found, you can use the musl
version.
If I empty out nsswitch.conf it starts working :o
Also if the first value is "files" for the keys, it works.
So for example it works with this:
passwd: files systemd
group: files systemd
gshadow: files
shadow: files
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
So probably it's something in glibc + compat libs ... probably it wants to parse UID ... because it seems to happen only when "passwd" contains systemd or compat on first place, and the rest doesn't seem to matter (at least when I tested with "group".)
Thanks again!
Thanks @PAStheLoD , I tested on Ubuntu and Debian, if /etc/nsswitch.conf
file is configured with passwd: compat
, glibc will attempt to load libnss_compat.so
, libnss_nis.so
, libpthread.so
, etc. These libraries may not be compatible with the statically linked glibc
, and the program might crash.
Currently, there is no good solution for this issue, it is recommended to use the musl
version in this case.
Hello,
First of all thanks for maintaining this!
The details of the crash
Tried with the following kernel versions:
6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 11 15:25:05 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
6.11.0-8-generic #8-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 16 13:41:20 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
On Ubuntu 24.10 userspace.
It's a VM, and cpuinfo says it's a