🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
3 messages
3 total messages Started by bugzilla-noreply Mon, 23 Nov 2026 22:04
[Bug 301061] namei(9): ABI symlink restart pass dereferences a NULL path buffer after ERESTART
#684
Author: 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
[Bug 301061] namei(9): ABI symlink restart pass dereferences a NULL path buffer after ERESTART
#685
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 22:05
17 lines
2521 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301061

--- Comment #1 from laamalif@proton.me ---
Created attachment 277621
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277621&action=edit
Fix: reset abi_pass unconditionally when the expansion buffer is not
reinstalled

-- 
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
[Bug 301061] namei(9): ABI symlink restart pass dereferences a NULL path buffer after ERESTART
#686
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 22:05
17 lines
2455 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301061

--- Comment #2 from laamalif@proton.me ---
Please use:

Author: Laam Alif <laamalif@proton.me>
Reported by:    Laam Alif at Ibteda Digital Library
PR:             301061

-- 
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads