NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/60976: compat_linux does not recognize musl dynamic linker
>Number: 60976
>Category: kern
>Synopsis: compat_linux does not recognize musl dynamic linker
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Nov 06 22:50:00 +0000 2026
>Originator: Bobby Bingham
>Release: 11.1
>Organization:
>Environment:
NetBSD roko.local 11.1 NetBSD 11.1 (KOOROGI) #1: Fri Nov 6 16:08:42 CST 2026 koorogi@roko.local:/home/koorogi/netbsd/src/sys/arch/amd64/compile/obj/KOOROGI amd64
>Description:
One of the heuristics used by compat_linux to identify Linux binaries is to check the name of the interpreter. This check knows the name of the glibc dynamic loader, but not the musl dynamic loader. Dynamically linked executables using musl are not identified as Linux binaries by compat_linux, and do not run properly.
>How-To-Repeat:
On a Linux distribution that uses musl, compile any C program (e.g. a hello world program). Copy the musl dynamic linker (/lib/ld-musl-$ARCH.so.1) to /emul/linux/lib, and try to run the binary from NetBSD.
>Fix:
# HG changeset patch
# User Bobby Bingham <koorogi%koorogi.info@localhost>
# Date 1793941804 21600
# Thu Nov 05 23:10:04 2026 -0600
# Branch netbsd-11
# Node ID 7821e04967d5133b553ecf5326edb5ec1349088e
# Parent d108cdef9498cf4a5a8b212a73c9802c0b754ca6
compat_linux: recognize musl dynamic linker name
diff --git a/sys/compat/linux/common/linux_exec_elf32.c b/sys/compat/linux/common/linux_exec_elf32.c
--- a/sys/compat/linux/common/linux_exec_elf32.c
+++ b/sys/compat/linux/common/linux_exec_elf32.c
@@ -427,6 +427,7 @@
#if (ELFSIZE == 64)
!strncmp(itp, "/lib64/ld-linux", 15) ||
#endif
+ !strncmp(itp, "/lib/ld-musl-", 13) ||
!strncmp(itp, "/lib/ld.so.", 11))
error = 0;
else
Home |
Main Index |
Thread Index |
Old Index