HomeFreeBSD

bhyve blockif: fix blockif_candelete with Capsicum

Description

bhyve blockif: fix blockif_candelete with Capsicum

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

(cherry picked from commit d8c1d7b6526c7063304cd1e938d12dec137454e2)

Details

Provenance
chuckAuthored on Dec 1 2021, 5:07 AM
Parents
rGb7a2cf0d9102: bhyve: fix NVMe MDTS comment
Branches
Unknown
Tags
Unknown