Page MenuHomeFreeBSD

unix: Preserve FD_RESOLVE_BENEATH when passing an fd
AcceptedPublic

Authored by markj on Fri, Jul 17, 9:51 PM.

Details

Reviewers
kib
Summary

The FD_RESOLVE_BENEATH flag is supposed to be sticky. It's set when you
receive an fd from a different jail and preserved by openat(<dfd>) etc..
However, if you send the fd to yourself, the flag is stripped since
SCM_RIGHTS message don't preserve file descriptor flags.

Fix this by preserving those flags and checking for UF_RESOLVE_BENEATH
in restrict_rights().

Fixes: 350ba9672a7f ("unix: Set O_RESOLVE_BENEATH on fds transferred between jails")

Diff Detail

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

Event Timeline

markj requested review of this revision.Fri, Jul 17, 9:51 PM
kib added inline comments.
sys/kern/uipc_usrreq.c
3517

BTW why not return the UF_ flag(s) directly from restrict_rights, instead of using ternary operator in the calling place?

This revision is now accepted and ready to land.Fri, Jul 17, 11:01 PM