From nobody Tue Nov 30 21:50:07 2021 X-Original-To: dev-commits-src-all@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 B74EE18B935F; Tue, 30 Nov 2021 21:50:07 +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 4J3bVR3NGJz3mgl; Tue, 30 Nov 2021 21:50:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 558841DD61; Tue, 30 Nov 2021 21:50:07 +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 1AULo7PB071663; Tue, 30 Nov 2021 21:50:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AULo7S8071660; Tue, 30 Nov 2021 21:50:07 GMT (envelope-from git) Date: Tue, 30 Nov 2021 21:50:07 GMT Message-Id: <202111302150.1AULo7S8071660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: d8c1d7b6526c - main - bhyve blockif: fix blockif_candelete with Capsicum List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: d8c1d7b6526c7063304cd1e938d12dec137454e2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638309007; 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=8mNuOYZG35x949e0/KgVQo1wnFhaUc+SBmWDAXjJQPA=; b=kFB5FF3wkxMf8+IQaNm+9Eb5Xtw7MtBzkIVi3XMaTlzhrzLUohOeBYNGrAxlvGJxnIm7oE 2zJuVbBq7+tFOHe9Fk1oYG006fYGoKP2IJ9dtxBp1jqKaJSq6Z7AF4RE1Jpm4qnIFHGB9I W+CCfWzBGYeLeQu0AxY+kcdx9f802ecNRM/pEZDmrW50RY23CYV+V3lKS4h9WEzSTq9kwV ihJ2jkgJTYFpKn68Zg9cWKxBQQl6LYmtZmfb1cs2V3e+xGi1Lmp9L0I0Tu6GWyqhFRMCNW c6Envr5HDd/one1Bf29NFHqkL9ZbSCXM6GymjznNBejI1D+gpqgvYTkx8eDchg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638309007; a=rsa-sha256; cv=none; b=VyCVduwp2uyVsIkTb3+vkfnpfoy+tUVUXfdOLKsrrDe3QEfdyjt/uzygbrWgZQN99fS06Z cWAhJ9z5coixzpsjIPdi2+7lTEpriHDl38FaTkRxFWYZQDAQqyglc+658+lmO76Z974lRo i/O2XIodQSFEXlQ+ddQCzbrDTWd5Z3S31ch7CJG3e+yHM0Fm6/cbkUNzx29hHsc+ZOst+d pAhKbkpXuZ/e/bZx/F/1/WglzlrbyQXvokFjj1VcxcNCrjSYPSA5x5cL3oYXY/A9BA9w47 DF6oTzinlT/mWgexR6Hd61SXV3GyZx5Wwc+Q5x2yf0uFW8P1cL/o3n6WupPF9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=d8c1d7b6526c7063304cd1e938d12dec137454e2 commit d8c1d7b6526c7063304cd1e938d12dec137454e2 Author: Chuck Tuffli AuthorDate: 2021-12-01 05:07:32 +0000 Commit: Chuck Tuffli CommitDate: 2021-12-01 05:49:34 +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 Reviewed by: allanjude, markj, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33203 --- 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 9d7371bec50f..d9813f30037f 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -548,7 +548,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);