🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

[Bug 301061] namei(9): ABI symlink restart pass dereferences a NULL path buffer after ERESTART

#684
From: bugzilla-noreply
Date: Mon, 23 Nov 2026 22:04
67 lines
4843 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301061

            Bug ID: 301061
           Summary: namei(9): ABI symlink restart pass dereferences a NULL
                    path buffer after ERESTART
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: laamalif@proton.me

namei() panics the kernel when a Linuxulator process with an altroot
(pwd_adir != pwd_rdir) has an absolute-symlink lookup restarted and the
second pass returns ERESTART. On an INVARIANTS kernel the MPASS at
sys/kern/vfs_lookup.c:719 fires ("cn_pnbuf != NULL"); on GENERIC the
kernel dereferences the NULL buffer a few lines later.

Commit 23b32672877 ("namei: retry absolute symlink expansions from the
native root", 2026-10-18) added a three-state abi_pass to namei(). The
restart block at the bottom of the error path does this when
vfs_lookup() fails:

- namei_cleanup_cnp() (line 859) frees cn_pnbuf to namei_zone and
  sets cn_pnbuf = NULL.
- The else branch at line 874 resets abi_pass to
    NAMEI_ABI_PASS_NATIVE only when abi_restart is true. abi_restart
  requires error == ENOENT and !ISRESTARTED.
- If the error is ERESTART instead (devfs_populate_vp() on a doomed
  devfs/pty node, fuse on a signal, nameicap_tracker_add()),
  abi_restart is false, abi_pass is left at NAMEI_ABI_PASS_SYMLINK,
  and line 889 jumps to restart.
- At restart (line 714) the SYMLINK pass skips namei_getpath() and
  asserts cn_pnbuf != NULL, which is now NULL. The expansion buffer it
  expects was the one line 859 just freed.

The panic needs the symlink-restart state to have been entered first
(an ENOENT on an altroot absolute-symlink pass), then an ERESTART on
the second pass, so the trigger is Linuxulator binaries with paths
through /compat/linux absolute symlinks that land on a doomed devfs or
fuse node at the right moment. I have not reproduced it at runtime;
the sequence is derived from the source. PR 298546 is a different
namei panic (the NDREINIT debug assertion, and on arm64); this is the
abi_pass NULL deref.

The fix is to reset abi_pass whenever the expansion buffer is not
being reinstalled, not only when abi_restart is set. In the else
branch at line 874, abi_pass should be set to NAMEI_ABI_PASS_NATIVE
unconditionally: the branch has just either freed abi_symlink or let
namei_cleanup_cnp() free the installed buffer, so no SYMLINK-pass
buffer exists either way. The attached patch does this.

I have not built or booted a kernel with the patch; the change is one
line in an error path that currently reaches the MPASS.

-- 
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-301061-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 301061] namei(9): ABI symlink restart pass dereferences a NULL
 path buffer after ERESTART
Date: Mon, 23 Nov 2026 22:04:59 +0000
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-301061-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="34521"; 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=1795471499;
	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=j3iOt/11pNSJHqvYwDSEm58u/A/YeyICFsKLaOp6g9g=;
	b=ogfYzMmN59pX4HQ8N1Ys4rV4i3aIn888MBPrLTjdCP5lZOhFfBy36KIDHA+KBQX5ABjVoS
	BH6b7ktDdljNTCi7ZH19l06Evh6B5YSUAAWrKk40N1MGX7QpAPY3fx+CLy3njORmRWLWA3
	S2fi7bTw9/TiPPYRDbKZYXWib9qorYK61pwMBnZeZlz6GGKWwjb2/mw6IaLvddItybCGKs
	MiiPaQju/rofgCt3IDWXe+0db8HOKI5+2mo7diRcyntCuJTjGnI6Akk3RSGxX+u+CX3vjN
	JxSM/nD7p+BW+Q+xtmHyOHLiHezbh+eiacm9xcxdt0GZkosKVhLp6ZFlXbNwxQ==
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