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)
Mon, Jul 13, 2:29 AM
Unknown Object (File)
Jun 18 2026, 6:39 AM
Unknown Object (File)
Jun 8 2026, 6:01 AM
Unknown Object (File)
Jun 5 2026, 2:30 PM
Unknown Object (File)
Jun 5 2026, 12:35 PM
Unknown Object (File)
Jun 3 2026, 3:51 PM
Unknown Object (File)
May 31 2026, 12:29 PM
Unknown Object (File)
May 30 2026, 9:40 PM
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 Not Applicable
Unit
Tests Not Applicable

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
994

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
994

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