Page MenuHomeFreeBSD

vfs: Let prison_enforce_statfs zero the fsid
ClosedPublic

Authored by des on Dec 13 2025, 10:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 22, 11:13 PM
Unknown Object (File)
Fri, Jan 16, 10:22 AM
Unknown Object (File)
Wed, Jan 14, 1:10 PM
Unknown Object (File)
Mon, Jan 12, 10:18 AM
Unknown Object (File)
Thu, Jan 8, 1:44 PM
Unknown Object (File)
Tue, Jan 6, 3:42 PM
Unknown Object (File)
Dec 31 2025, 1:27 PM
Unknown Object (File)
Dec 31 2025, 12:26 AM
Subscribers

Details

Summary

Currently, we unconditionally zero the fsid before returning a struct
statfs to a jailed process. Move this into prison_enforce_statfs() so
it only happens if enforce_statfs is greater than 1, or enforce_statfs
is 1 but the mountpoint is outside the jail.

PR: 291301
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Dec 13 2025, 10:08 PM
This revision is now accepted and ready to land.Dec 14 2025, 2:13 AM

@kib can you also please take a look at the PR? the originator claims this used to work as recently as 14.2 but I see no evidence that it has ever worked, the code to zero out the fsid has been there since 1997.

In D54214#1238647, @des wrote:

@kib can you also please take a look at the PR? the originator claims this used to work as recently as 14.2 but I see no evidence that it has ever worked, the code to zero out the fsid has been there since 1997.

I concur. I looked both at kern_do_statfs() and at priv_check_cred_vfs_generation{,slow}() on 14.2.0 and then 14.0.0, and I come to the same conclusion as you.

This revision was automatically updated to reflect the committed changes.