Page MenuHomeFreeBSD

vfs: allow lookup through VV_READLINK vnodes
Needs ReviewPublic

Authored by chris.longros_gmail.com on Sun, Aug 30, 7:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 31, 12:34 AM
Unknown Object (File)
Sun, Aug 30, 8:06 PM
Unknown Object (File)
Sun, Aug 30, 10:20 AM
Unknown Object (File)
Sun, Aug 30, 9:22 AM
Unknown Object (File)
Sun, Aug 30, 9:20 AM
Unknown Object (File)
Sun, Aug 30, 9:17 AM
Subscribers

Details

Reviewers
kib
dchagin
Summary

When fdescfs(5) is mounted with linrdlnk, /dev/fd/N uses VV_READLINK, so a lookup through a path like /dev/fd/N/name fails with ENOTDIR.

I hit the issue trying to run the latest claude-code 2.1.251 that introduced "Fixed file tools (Read, Write, Edit) following a symlink swapped inside the working directory after the permission check, which could read or write outside the approved location"

Test Plan

Tested on FreeBSD 16 CURRENT with a patched kernel.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76330
Build 73213: arc lint + arc unit

Event Timeline

This is a special case that should be not handled by the generic VFS lookup code. Ideally, it should be contained to the fdescfs vop_lookup(). I am not sure how, the obvious idea to change the vnode return type when !ISLASTCN has some drawbacks, at very least the vnode must be reclaimed on deactivation, might be it would work then.

Also, please provide the minimal sample that shows the desired behavior.