Page MenuHomeFreeBSD

Some tweaks to kern_chroot(2)
ClosedPublic

Authored by kib on Aug 2 2025, 6:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 31, 9:35 AM
Unknown Object (File)
Sat, Jan 31, 8:42 AM
Unknown Object (File)
Fri, Jan 30, 10:43 PM
Unknown Object (File)
Fri, Jan 30, 7:42 PM
Unknown Object (File)
Dec 16 2025, 4:19 AM
Unknown Object (File)
Dec 16 2025, 4:19 AM
Unknown Object (File)
Dec 5 2025, 6:23 PM
Unknown Object (File)
Nov 13 2025, 4:50 AM
Subscribers

Details

Summary
vfs_syscall.c: do not take process lock around the read of P2_NO_NEW_PRIVS

The flag is write-only, and if we raced with reading the action of
setting the flag, we can as well get it under the lock.


vfs_syscall.c: EXTERROR-ise EPERM from chroot(2)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Aug 2 2025, 6:03 PM

Maybe be explicit that unprivileged_chroot is a sysctl/tunable, e.g. security.bsd.unprivileged_chroot sysctl not enabled

This revision is now accepted and ready to land.Aug 2 2025, 6:10 PM

EXTERROR msg for disabled sysctl

This revision now requires review to proceed.Aug 2 2025, 6:13 PM
kevans added inline comments.
sys/kern/vfs_syscalls.c
993

I don't feel that strongly here, but I think if I were to read this as someone unfamiliar, my question would be: "How does P2_NO_NEW_PRIVS get set?" -> a string that appears in a manpage to answer that would probably curtail that.

This revision is now accepted and ready to land.Aug 2 2025, 6:16 PM
sys/kern/vfs_syscalls.c
993

s/PROCS/PROC/, of course. bah.

kib marked 2 inline comments as done.

Use API flag name, not kernel internal flag.

This revision now requires review to proceed.Aug 2 2025, 6:30 PM
This revision is now accepted and ready to land.Aug 2 2025, 6:31 PM