opnsense-src/lib/libsys
Mark Johnston 93d226e6e4 vfs: Disallow renameat() with FD_RESOLVE_BENEATH descriptors
The FD_RESOLVE_BENEATH flag was intended to try to resolve bugzilla PR
262179 without entirely disallowing fd passing between jails.  However,
one can use renameat() to bypass the restriction: upon receiving a
directory fd with FD_RESOLVE_BENEATH set, a jailed process can still
move its CWD or one of its ancestors to the directory, and just cd
out of its jail root.

So disallow renameat() when either the source or destination directory
fds has FD_RESOLVE_BENEATH set, like we do with fchdir() and fchroot()
to prevent similar escapes.

Approved by:	so
Security:	FreeBSD-SA-26:66.jail
Security:	CVE-2026-101305
PR:		262179
Reported by:	firk@cantconnect.ru
Reviewed by:	olce, kib
Differential Revision:	https://reviews.freebsd.org/D59875
2026-09-30 11:46:48 +02:00
..
aarch64 libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
amd64 libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
arm libsys/arm: include ARM EABI unwind bits into libsys 2026-02-20 17:44:55 +01:00
i386 libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
powerpc libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
powerpc64 libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
powerpcspe lib{c,sys}: fix powerpcspe build 2024-03-13 20:09:41 +00:00
riscv libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
x86 pkru: Fix handling of 1GB largepage mappings 2026-04-21 15:42:41 +00:00
__error.c lib{c,sys}: stop exposing errno symbol 2024-09-27 20:27:46 +01:00
__getosreldate.c libc: move __getosreldate to libsys 2024-02-05 20:34:56 +00:00
__vdso_gettimeofday.c
_exit.2 _exit.2: Cross-reference atexit(3) 2026-04-10 14:30:21 -04:00
_libsys.h Regen 2026-03-10 13:41:32 +02:00
_umtx_op.2 Implement CLOCK_TAI 2025-06-12 12:25:31 -06:00
_umtx_op_err.c libthr: move _umtx_op_err() to libsys 2024-02-05 20:34:56 +00:00
abort2.2
accept.2 Add manpages for O_CLOFORK flag and others 2025-07-06 23:08:41 +00:00
access.2 faccessat(2): Honor AT_SYMLINK_NOFOLLOW 2024-08-11 17:49:06 +02:00
acct.2
adjtime.2
aio_cancel.2 Remove mentions of ENOSYS added in d97e44784b 2025-03-27 19:40:07 -07:00
aio_error.2 Remove mentions of ENOSYS added in d97e44784b 2025-03-27 19:40:07 -07:00
aio_fsync.2 Remove mentions of ENOSYS added in d97e44784b 2025-03-27 19:40:07 -07:00
aio_mlock.2 Remove mentions of ENOSYS added in d97e44784b 2025-03-27 19:40:07 -07:00
aio_read.2 Bump .Dd for recently changed aio_*(2) manpages 2025-03-27 19:43:26 -07:00
aio_return.2 Remove mentions of ENOSYS added in d97e44784b 2025-03-27 19:40:07 -07:00
aio_suspend.2 Remove mentions of ENOSYS added in d97e44784b 2025-03-27 19:40:07 -07:00
aio_waitcomplete.2 Bump .Dd for recently changed aio_*(2) manpages 2025-03-27 19:43:26 -07:00
aio_write.2 Bump .Dd for recently changed aio_*(2) manpages 2025-03-27 19:43:26 -07:00
auxv.3 libsys: Add AT_HWCAP3 and AT_HWCAP4 2025-06-24 17:26:40 +01:00
auxv.c libsys: Add AT_HWCAP3 and AT_HWCAP4 2025-06-24 17:26:40 +01:00
bind.2
bindat.2
brk.2
cap_enter.2
cap_fcntls_limit.2
cap_ioctls_limit.2
cap_rights_limit.2 rights.4: various corrections on capability rights 2024-04-28 22:48:31 -06:00
chdir.2
chflags.2
chmod.2 unix: Add support for atomically setting the socket mode 2024-11-03 16:46:53 +00:00
chown.2
chroot.2 chroot.2: "filedescriptors" => "file descriptors" 2026-04-30 19:58:46 +02:00
clock_gettime.2 clock_gettime: Better markup 2025-06-13 12:29:38 -06:00
clock_gettime.c
close.2 tcp: don't ever return ECONNRESET on close(2) 2024-12-23 10:35:49 -08:00
closefrom.2 closefrom.2: Add introduction of close_range to HISTORY 2025-10-29 09:42:39 -04:00
connect.2
connectat.2
copy_file_range.2 copy_file_range.2: Document the COPY_FILE_RANGE_CLONE flag 2025-08-22 15:01:59 -07:00
cpuset.2
cpuset_getaffinity.2
cpuset_getdomain.2
creat.2 libsys: move __libsys_interposer consumers 2024-02-05 20:34:55 +00:00
dup.2 dup(2): document the handling of filedescriptor flags 2026-03-31 07:07:17 +03:00
eventfd.2
execve.2 Add manpages for O_CLOFORK flag and others 2025-07-06 23:08:41 +00:00
extattr_get_file.2
fcntl.2 vfs: Disallow renameat() with FD_RESOLVE_BENEATH descriptors 2026-09-30 11:46:48 +02:00
ffclock.2
fhlink.2 manuals: Fix errors in .2 pages 2024-09-20 11:37:02 -03:00
fhopen.2 fhopen.2: Fix named_attribute man section 2025-07-20 08:17:01 -07:00
fhreadlink.2 fhreadlink.2: fix old typo in the manpage 2024-11-25 18:38:20 +00:00
flock.2
fork.2 fork.2: note that all methods to pre-resolve symbols have consequences 2026-04-17 03:42:38 +03:00
fspacectl.2
fsync.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
getdirentries.2 getdirentries: Return ENOTDIR if not a directory. 2025-07-09 22:34:18 +02:00
getdtablesize.2
getfh.2 manuals: Fix errors in .2 pages 2024-09-20 11:37:02 -03:00
getfsstat.2
getgid.2
getgroups.2 getgroups.2: Simplifications; Be clearer on programs to be modified 2025-10-10 19:03:16 +02:00
getitimer.2
getlogin.2
getloginclass.2
getpagesize.3 libc: move getpagesize(s) to libsys 2024-02-05 20:34:56 +00:00
getpagesize.c libc: move getpagesize(s) to libsys 2024-02-05 20:34:56 +00:00
getpagesizes.3 libc: move getpagesize(s) to libsys 2024-02-05 20:34:56 +00:00
getpagesizes.c libc: move getpagesize(s) to libsys 2024-02-05 20:34:56 +00:00
getpeername.2
getpgrp.2
getpid.2
getpriority.2
getrandom.2
getrlimit.2 getrlimit(2): document RLIMIT_PIPEBUF 2024-09-20 09:46:06 +03:00
getrlimitusage.2 getrlimitusage.2: Update HISTORY section 2025-10-27 10:34:42 -04:00
getrusage.2
getsid.2
getsockname.2
getsockopt.2 divert: Define semantics for SO_REUSEPORT_LB on divert sockets 2026-06-25 11:18:46 +02:00
gettimeofday.2 gettimeofday.2: Do mention improbable future removal 2024-04-28 20:11:22 +02:00
gettimeofday.c
getuid.2
inotify.2 inotify: Add man pages for the new syscalls and for VOP_INOTIFY 2025-07-04 14:42:33 +00:00
interposing_table.c lib/libsys, lib/libc: export pdwait 2026-02-01 23:38:49 +02:00
intro.2 intro.2 as errno.2: Use the name macro for errno 2024-05-04 08:56:10 -06:00
ioctl.2 ioctl.2: Mention EACCES 2026-01-01 13:05:06 -05:00
issetugid.2
jail.2 man typos: Fix pf.conf.5 and jail.2 typos 2026-01-01 13:05:03 -05:00
kcmp.2
kenv.2
kill.2
kldfind.2 linker: Make linker.h more self-contained 2024-10-26 14:05:56 +00:00
kldfirstmod.2 linker: Make linker.h more self-contained 2024-10-26 14:05:56 +00:00
kldload.2 kldload.2: Provide more info about file argument 2026-04-10 14:29:36 -04:00
kldnext.2 linker: Make linker.h more self-contained 2024-10-26 14:05:56 +00:00
kldstat.2 linker: Make linker.h more self-contained 2024-10-26 14:05:56 +00:00
kldsym.2 linker: Make linker.h more self-contained 2024-10-26 14:05:56 +00:00
kldunload.2 linker: Make linker.h more self-contained 2024-10-26 14:05:56 +00:00
kqueue.2 kqueue.2: Fix reference to unexisting kevent1() 2026-02-09 18:03:41 +00:00
ktrace.2
libc_stubs.c lib{c,sys}: move auxargs more firmly into libsys 2024-02-19 22:44:08 +00:00
libsys.h libsys: add a libsys.h 2024-04-16 17:48:07 +01:00
libsys_sigwait.c libsys: don't expose sigwait wrapper 2024-03-13 17:04:07 +00:00
link.2
lio_listio.2 lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset 2024-02-11 03:53:50 +02:00
listen.2
lockf.3 libsys: move some missed manpages 2024-02-08 19:50:32 +00:00
lseek.2
madvise.2
Makefile lib{c,sys}: stop exposing errno symbol 2024-09-27 20:27:46 +01:00
Makefile.depend Update Makefile.depend files 2024-10-14 10:26:17 -07:00
Makefile.sys libsys: install manpage links for jail_attach_jd/jail_remove_jd 2026-04-11 22:15:08 -05:00
membarrier.2 membarrier.2: document MEMBARRIER_CMD_GET_REGISTRATIONS 2026-04-27 04:28:59 +03:00
mincore.2
minherit.2
mkdir.2 mkdir.2: Correct HISTORY 2025-07-23 12:37:44 -04:00
mkfifo.2
mknod.2
mlock.2
mlockall.2
mmap.2
modfind.2
modnext.2
modstat.2
mount.2
mprotect.2
mq_close.2
mq_getattr.2
mq_notify.2
mq_open.2 mq_open(2): document sysctl limit EINVAL and ENFILE conditions 2026-04-16 12:25:07 -03:00
mq_receive.2
mq_send.2
mq_setattr.2
mq_unlink.2 man filesystems: fix xrefs after move to section 4 2024-05-16 10:25:29 -06:00
msgctl.2
msgget.2
msgrcv.2
msgsnd.2
msync.2
munmap.2 munmap.2: Add STANDARDS and note about portability 2025-01-16 12:50:47 -05:00
nanosleep.2 Implement CLOCK_TAI 2025-06-12 12:25:31 -06:00
nfssvc.2
ntp_adjtime.2 ntp_adjtime.2: Increase visibility 2026-04-20 12:18:41 -04:00
open.2 open.2: grammar improvements 2026-02-18 10:00:50 +02:00
pathconf.2 pathconf.2: Document the new _PC_CASE_INSENSITIVE name 2025-11-23 12:24:10 -08:00
pdfork.2 pdfork.2: correct pdrfork's HISTORY section 2026-04-27 13:37:22 -06:00
pdrfork_thread_gen.c libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
pipe.2 Add manpages for O_CLOFORK flag and others 2025-07-06 23:08:41 +00:00
poll.2 Tweak ppoll() to include 1003.1-2024 visibility, take two 2024-12-14 22:40:16 -06:00
posix_fadvise.2
posix_fallocate.2
posix_openpt.2
procctl.2 procctl.2: Align list indentation 2026-04-10 14:30:26 -04:00
profil.2
pselect.2
ptrace.2 manuals: Correct some sysctl markup 2026-02-05 16:49:53 -05:00
ptrace.c
quotactl.2
rctl_add_rule.2
read.2 read(2): Add write cross reference 2024-03-01 20:36:39 -07:00
readlink.2 manpage: cross link fhreadlink(2) <-> readlink(2) 2024-11-25 09:02:34 +00:00
reboot.2
recv.2 Add manpages for O_CLOFORK flag and others 2025-07-06 23:08:41 +00:00
recvmmsg.c include: ssp: fortify <sys/socket.h> 2024-07-13 00:16:26 -05:00
rename.2 renameat2(2): document 2026-03-10 13:41:32 +02:00
revoke.2 revoke.2: Remove mention of block special device files 2025-11-03 13:46:28 +01:00
rfork.2 Document pdrfork(2) and pdwait(2) 2026-02-01 23:38:49 +02:00
rfork_thread.3 libc: move rfork_thread(3) to libsys 2024-02-05 20:34:56 +00:00
rfork_thread_gen.c libsys, libc: provide rfork_thread() and pdrfork_thread() on all arches 2026-02-01 23:38:50 +02:00
rmdir.2
rtprio.2
sched_get_priority_max.2
sched_getcpu.3 sched_getcpu: Add man page 2024-11-13 19:32:04 -05:00
sched_getcpu_gen.c libc: libc/gen/sched_getcpu_gen.c -> libsys/ 2024-02-05 20:34:55 +00:00
sched_setparam.2
sched_setscheduler.2
sched_yield.2
sctp_generic_recvmsg.2
sctp_generic_sendmsg.2
sctp_peeloff.2
select.2
semctl.2
semget.2
semop.2
send.2
sendfile.2 sendfile: retire SF_SYNC 2025-06-24 15:24:04 -07:00
sendmmsg.c libsys: move __libsys_interposer consumers 2024-02-05 20:34:55 +00:00
setcred.2 setcred.2: Remove now obsolete mention of setgroups(2)'s different behavior 2025-09-23 14:02:47 +02:00
setfib.2 setfib.2: Note that the number of FIBs can be adjusted after boot 2025-01-21 15:39:50 +00:00
setgroups.2 setgroups.2: Add SECURITY CONSIDERATIONS, fix the groups limit, rework 2025-09-23 14:02:47 +02:00
setpgid.2
setregid.2
setresuid.2
setreuid.2
setsid.2
setuid.2
shm_open.2 libc: fix memfd_create's HUGETLB handling 2026-04-12 22:12:44 -05:00
shmat.2
shmctl.2
shmget.2
shutdown.2
sigaction.2
sigaltstack.2
sigfastblock.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
sigpending.2
sigprocmask.2
sigqueue.2 sigqueue(2): Document __SIGQUEUE_TID 2024-04-23 19:51:10 +03:00
sigreturn.2 sigreturn.2: refresh the man page 2026-03-14 14:02:34 +02:00
sigstack.2
sigsuspend.2
sigwait.2
sigwaitinfo.2
sleep.3 libsys: move some missed manpages 2024-02-08 19:50:32 +00:00
socket.2 socket(2): refactor the manual page 2025-10-15 11:58:54 -07:00
socketpair.2 Add manpages for O_CLOFORK flag and others 2025-07-06 23:08:41 +00:00
stat.2 stat(2): Document the st_rdev field 2025-08-17 19:29:27 +02:00
statfs.2 statfs.2: Fix named_attribute man section 2025-07-20 08:23:02 -07:00
swapon.2 manuals: Misc macro typos 2024-09-21 05:25:15 -06:00
Symbol.map libsys: drop private exports no longer needed 2025-10-01 06:00:08 +03:00
Symbol.sys.map sys: add renameat2(2) syscall 2026-03-10 13:41:31 +02:00
Symbol.thr.map libthr: move _umtx_op_err() to libsys 2024-02-05 20:34:56 +00:00
symlink.2 symlink.2: document EOPNOTSUPP 2025-04-15 00:03:19 +02:00
sync.2
sysarch.2
syscall.2
syscalls.map Regen 2026-03-10 13:41:32 +02:00
thr_exit.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
thr_kill.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
thr_new.2 thr_new.2: document THR_C_RUNTIME 2025-05-31 17:55:24 +03:00
thr_self.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
thr_set_name.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
thr_suspend.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
thr_wake.2 Canonicalize the name of the FreeBSD Foundation 2024-10-24 05:03:07 +08:00
timer_create.2 Implement CLOCK_TAI 2025-06-12 12:25:31 -06:00
timer_delete.2
timer_settime.2
timerfd.2 timerfd.2: Add documentation for CLOCK_UPTIME and CLOCK_BOOTTIME 2024-07-02 10:40:04 -06:00
truncate.2
umask.2
undelete.2
unlink.2
usleep.3 libsys: move some missed manpages 2024-02-08 19:50:32 +00:00
utimensat.2
utimes.2
utrace.2
uuidgen.2
vfork.2
wait.2 Document pdrfork(2) and pdwait(2) 2026-02-01 23:38:49 +02:00
write.2 write.2: explain the atomicity guarantees of the writes 2025-10-31 16:41:03 +02:00