🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.bugs
Article #196

[Bug 299836] [linuxulator][arm64] Linux brand does not set LINUX_BI_FUTEX_REQUEUE, musl containers deadlock on FUTEX_REQUEUE

#196
From: bugzilla-noreply
Date: Fri, 23 Oct 2026 09:01
143 lines
7093 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299836

            Bug ID: 299836
           Summary: [linuxulator][arm64] Linux brand does not set
                    LINUX_BI_FUTEX_REQUEUE, musl containers deadlock on
                    FUTEX_REQUEUE
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: amutu@amutu.com

linux_futex() only allows FUTEX_REQUEUE when the process' ELF brandinfo sets
the
LINUX_BI_FUTEX_REQUEUE flag; otherwise the operation is logged as unsupported
and EINVAL is
returned:
        case LINUX_FUTEX_REQUEUE:
                ...
                /*
                 * The above is true, however musl libc does make use of the
                 * futex requeue operation, allow operation for brands which
                 * set LINUX_BI_FUTEX_REQUEUE bit of Brandinfo flags.
                 */
                bi = td->td_proc->p_elf_brandinfo;
                if (bi == NULL || ((bi->flags & LINUX_BI_FUTEX_REQUEUE)) == 0)
                        return (EINVAL);
The flag is set by the amd64 and i386 brands — amd64 even carries a dedicated
linux_muslbrand
entry with interp_path = "/lib/ld-musl-x86_64.so.1". The arm64 brand does not
set it, and arm64 has
no musl brand at all:
/* sys/arm64/linux/linux_sysvec.c */
static const Elf64_Brandinfo linux_glibc2brand = {
        .brand          = ELFOSABI_LINUX,
        .machine        = EM_AARCH64,
        .compat_3_brand = "Linux",
        .interp_path    = "/lib64/ld-linux-x86-64.so.2",
        .sysvec         = &elf_linux_sysvec,
        .interp_newpath = NULL,
        .brand_note     = &linux64_brandnote,
        .flags          = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
};

const Elf64_Brandinfo *linux_brandlist[] = {
        &linux_glibc2brand,
        NULL
};
musl uses FUTEX_REQUEUE in its condition-variable path. With EINVAL returned,
waiters are never
requeued/woken, the wakeup is lost, and the process deadlocks: every thread
ends up sleeping in
linux_sys_futex and no further syscalls are issued.
In practice this is the second blocker for musl-based Linux containers on
arm64. After the
linux_mremap() fix (PR #1) is applied, the CPU spin is gone but node -e still
never completes;
dmesg shows:
linux: jid 15 pid 4476 (DelayedTaskSche): unsupported FUTEX_REQUEUE

【Steps to reproduce】

1. Apply the linux_mremap() fix (PR 299835:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299835), otherwise the
process spins before reaching this bug.
2. Run any Alpine/musl Linux container that starts Node.js:
sudo podman run --rm --os=linux ghcr.io/gethomepage/homepage:latest node -e
"console.log(1)"
Observed: the process hangs with 0% CPU, all threads in umtxq_sleep, and no
mremap/futex
traffic afterwards; dmesg contains unsupported FUTEX_REQUEUE.
$ sudo procstat -kk <pid>
  mi_switch ... _sleep ... umtxq_sleep ... linux_sys_futex ...   (all threads)
$ sudo dtrace -n 'fbt::linux_*:entry /pid==<pid>/ { @[probefunc]=count(); }
tick-2s {exit(0);}'
  (no output — zero syscalls in two seconds)

【Fix】

Allow FUTEX_REQUEUE on arm64 by setting the brand flag. A faithful port of the
amd64 layout (a
separate linux_muslbrand with /lib/ld-musl-aarch64.so.1) is also possible and
probably desirable,
but the flag alone is sufficient and has no effect on glibc binaries, which do
not issue this
operation.
--- a/sys/arm64/linux/linux_sysvec.c
+++ b/sys/arm64/linux/linux_sysvec.c
@@ -601,7 +601,8 @@ static const Elf64_Brandinfo linux_glibc2brand = {
        .sysvec         = &elf_linux_sysvec,
        .interp_newpath = NULL,
        .brand_note     = &linux64_brandnote,
-       .flags          = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+       .flags          = BI_CAN_EXEC_DYN | BI_BRAND_NOTE |
+                           LINUX_BI_FUTEX_REQUEUE
 };
Affected versions checked: releng/15.1 and main; the arm64 file is identical in
both.

【Test plan】

- After the patch dmesg no longer reports unsupported FUTEX_REQUEUE, and
podman run --rm --os=linux <alpine image> node -e "console.log('ok')" prints ok
and exits 0.
- End-to-end: the original workload starts and serves requests —
$ sudo podman run --rm --os=linux --network=host \
    -e HOSTNAME=0.0.0.0 -e HOMEPAGE_ALLOWED_HOSTS=gethomepage.dev \
    ghcr.io/gethomepage/homepage:latest
▲ Next.js 16.3.8
- Network:  http://0.0.0.0:3000
✓ Ready in 0ms

$ curl -H "Host: gethomepage.dev" -o /dev/null -w "%{http_code}\n"
http://127.0.0.1:3000/
200

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-299836-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 299836] [linuxulator][arm64] Linux brand does not set
 LINUX_BI_FUTEX_REQUEUE, musl containers deadlock on FUTEX_REQUEUE
Date: Fri, 23 Oct 2026 09:01:26 +0000
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-bugs@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-299836-227@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="60534"; mail-complaints-to="news-admin@muc.de"
X-Original-To: bugs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1792746086;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=f9q3cZBWJ0kGDVb13l4IFFzWhV4RHeIDwuVIdYCdzHs=;
	b=EKuYYAJPNiglnKj5wTv/EqTEBS2jHyhI7uJZUZ4qIVv70GVUNIpvT/n6f+oU8QBMr7bkFl
	mInTXvJU3kAInzRCl3j63m37C7oLfam3PRL/F0lMccII1ERn2GgwHEu/XDScFNqEWzoOVk
	vCt2Y5ue4JmfGbIU48R5ETXXSPvGwMLnM3zVaREmjst0jVm0KayDklcnI74CJA/IkzU5ge
	BPvBxo6+x7ET8tUDVQDATGm29FrBNd2X6AuXcZfDM3shHRlU2nvIKZh2BzmpOOGpfZbMHr
	mikBxCn7X9GhwazkHXnXd82oEG4x1UAeooAp4sPya9XoVY+5ELAU/FQqrPMI1w==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes