From nobody Mon Feb 21 21:57:47 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0141B19EACD2; Mon, 21 Feb 2022 21:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K2bkz6LP6z4gQn; Mon, 21 Feb 2022 21:57:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P6lvMc9htD/jvEiXW+672id5en4gYU/oBFKvw5hDKLk=; b=CZhXwuMsGWfEFKch/uvLVVLRJvL+AR5n4fJdm137EHcOtT2X9rtSK80pBLFLeRxnx6IuR+ I0pATxioR4y+VqitqH9smX1OPoeM9+zNkVMkSEMCvwS205xvgRz1PWuH5wGVr7VWX/xhaL pc3yJgr6wZpxXvx7D5PKnDttHmfVD6M7m2jviK34S4b8Z73TjZxouqqsdYEGlzoeNp+SNq TSD84o9fDRR+EUqYVGVO5A9SK2JcKQ2Sb8mNNlwWg0hTf6JA46WKANfOmN3rTCu6fVTeO9 prfs6a8qf9NNDrQzUmFIrgl0M7UrD+qt+E5oiqlF14VxmBlezGAC6wCSHsZr5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9405180A9; Mon, 21 Feb 2022 21:57:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21LLvlVp051909; Mon, 21 Feb 2022 21:57:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21LLvlRs051908; Mon, 21 Feb 2022 21:57:47 GMT (envelope-from git) Date: Mon, 21 Feb 2022 21:57:47 GMT Message-Id: <202202212157.21LLvlRs051908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Tuffli Subject: git: 1685d8368c2f - stable/13 - bhyve blockif: fix blockif_candelete with Capsicum List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1685d8368c2f78012f6d2d045f29193156a8580d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645480667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P6lvMc9htD/jvEiXW+672id5en4gYU/oBFKvw5hDKLk=; b=LDH6KF1Y+dN8BCdf0Yn44u8CLMxzuFsJIJbURmK8hjqkhw2TL2q95t0JU9EFPVjJYNIfwm yjikDMC30B4+ZojawVFwjD10JtPxG++UfFOaKKjY1M8G1TPop2Bx2aBU1J24CikZzboi/K QcM3O+mYpbSIOI8z+YikcApcnVk7OOfQwNQBly3jmRRqQiaRcomu9W8yXJxyiysFhseqNz 53RkZmfPfM6v0RmBOEfwZJzP/xprZW/7YmjetivrNnPsH9rjy74s0DtNPB6jAIkUetTc9k 919nmBd3UuicPyjMFpMDFUNVoQsgKsxIjtBXRGHP9uhKB1vR9y/juUwtPLe5cQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645480667; a=rsa-sha256; cv=none; b=YTintAZtlnBHJfdItUQjvI0xc/vLwT1oRg9BPqhlLif9/DhYUG0bZutDLNjBGhXqjD+yP3 cIGUBVvu4p+NiEciV1bL9NFuPZ37vT/cHlqvFI3peg+BDHhG6bgF9yavAbLkVb2RW8fkXq T9/Xxcl7Jhjg/s+myOKhmMsc38fkZxHEEoPBdEh5O1e15iyR/319BK6ODPx4G9ku0YVnT0 FPrReOKN643Ywja84tSbhbQgt1KHSstc3jVx6z8vc0fsYL2EgDSZkEqKrCJKbfxHqlFnWo py3kpLSCwhCQXUqNixFDmGR4H64V9fmfqyXIhcwu1iLxc/k9ev6++/O8kJ1Y6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=1685d8368c2f78012f6d2d045f29193156a8580d commit 1685d8368c2f78012f6d2d045f29193156a8580d Author: Chuck Tuffli AuthorDate: 2021-12-01 05:07:32 +0000 Commit: Chuck Tuffli 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);