Page MenuHomeFreeBSD

bhyve blockif: fix blockif_candelete with Capsicum
ClosedPublic

Authored by chuck on Nov 30 2021, 7:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 19, 3:49 AM
Unknown Object (File)
Sat, Oct 18, 5:13 PM
Unknown Object (File)
Sun, Oct 5, 12:13 AM
Unknown Object (File)
Sat, Oct 4, 11:09 AM
Unknown Object (File)
Sep 21 2025, 3:04 PM
Unknown Object (File)
Sep 19 2025, 7:01 AM
Unknown Object (File)
Sep 16 2025, 5:53 AM
Unknown Object (File)
Aug 29 2025, 6:09 PM

Details

Summary

NVMe conformance tests for the Format command failed if the
backing-storage for the bhyve device was a file instead of a Zvol. The
tests (and the specification) expect a Format to destroy all previously
written data. The bhyve NVMe emulation implements this by trimming /
deallocating all data from the backing-storage.

The blockif_candelete() function indicated the file did not support
deallocation (i.e. fpathconf(..., _PC_DEALLOC_PRESENT) returned FALSE)
even though the kernel supported file hole punching. This occurs on
builds with Capsicum enabled because blockif did not allow the
fpathconf(2) right.

Fix is to add CAP_FPATHCONF to the cap_rights_init(3) call.

PR: 260081

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 43067
Build 39955: arc lint + arc unit