git: 1685d8368c2f - stable/13 - bhyve blockif: fix blockif_candelete with Capsicum
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Feb 2022 21:57:47 UTC
The branch stable/13 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=1685d8368c2f78012f6d2d045f29193156a8580d commit 1685d8368c2f78012f6d2d045f29193156a8580d Author: Chuck Tuffli <chuck@FreeBSD.org> AuthorDate: 2021-12-01 05:07:32 +0000 Commit: Chuck Tuffli <chuck@FreeBSD.org> CommitDate: 2022-02-22 03:23:16 +0000 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) --- usr.sbin/bhyve/block_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index 98c0f9f5f38b..b12029ec4f04 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -535,7 +535,7 @@ blockif_open(nvlist_t *nvl, const char *ident) #ifndef WITHOUT_CAPSICUM cap_rights_init(&rights, CAP_FSYNC, CAP_IOCTL, CAP_READ, CAP_SEEK, - CAP_WRITE, CAP_FSTAT, CAP_EVENT); + CAP_WRITE, CAP_FSTAT, CAP_EVENT, CAP_FPATHCONF); if (ro) cap_rights_clear(&rights, CAP_FSYNC, CAP_WRITE);