Page MenuHomeFreeBSD

fdescfs: Pass up additional metadata during lookups
ClosedPublic

Authored by markj on Tue, Sep 22, 1:53 PM.
Tags
None
Referenced Files
F175847507: D59886.id187409.diff
Tue, Oct 13, 8:50 PM
Unknown Object (File)
Mon, Oct 12, 5:04 AM
Unknown Object (File)
Sat, Oct 10, 7:51 AM
Unknown Object (File)
Fri, Oct 9, 11:09 PM
Unknown Object (File)
Fri, Oct 9, 4:29 PM
Unknown Object (File)
Fri, Oct 9, 4:08 PM
Unknown Object (File)
Fri, Oct 9, 6:13 AM
Unknown Object (File)
Fri, Oct 9, 3:46 AM
Subscribers

Details

Summary

When an fdescfs mount has the nodup option set, fdesc_lookup(/dev/fd/n)
returns the vnode referenced by file descriptor n, rather than returning
an fdescfs vnode. This means that fd metadata attached to fd n is not
preserved when reopening the file, which is contrary to the expected
semantics for capsicum rights and the UF_RESOLVE_BENEATH fd flag. For
regular fdescfs mounts, this metadata is copied via dupfdopen().

Fix the problem by passing up this metadata through the nameidata
structure. Thus, if one opens /dev/fd/n, the returned fd will inherit
UF_RESOLVE_BENEATH and the capability rights of fd n. Add some
regression tests as well.

Reported by: Jan Bramkamp

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Tue, Sep 22, 1:53 PM
This revision is now accepted and ready to land.Tue, Sep 22, 3:27 PM