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)
Fri, Sep 19, 6:23 AM
Unknown Object (File)
Thu, Sep 18, 11:00 AM
Unknown Object (File)
Thu, Sep 18, 6:09 AM
Unknown Object (File)
Thu, Sep 18, 12:18 AM
Unknown Object (File)
Wed, Sep 17, 4:04 PM
Unknown Object (File)
Sat, Sep 13, 1:33 PM
Unknown Object (File)
Thu, Sep 11, 8:16 PM
Unknown Object (File)
Sat, Sep 6, 7:59 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 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