NetBSD Problem Report #60976
From www@netbsd.org Fri Nov 6 22:49:55 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 166D71A923B
for <gnats-bugs@gnats.NetBSD.org>; Fri, 6 Nov 2026 22:49:55 +0000 (UTC)
Message-Id: <20261106224953.D03031A923C@mollari.NetBSD.org>
Date: Fri, 6 Nov 2026 22:49:53 +0000 (UTC)
From: koorogi@koorogi.info
Reply-To: koorogi@koorogi.info
To: gnats-bugs@NetBSD.org
Subject: compat_linux does not recognize musl dynamic linker
X-Send-Pr-Version: www-1.0
X-From4GNATS: "koorogi@koorogi.info via gnats" <gnats-admin@NetBSD.org>
>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>
# 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
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.