From nobody Mon Jun 06 19:28:05 2022 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 493001BEE697; Mon, 6 Jun 2022 19:28:06 +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 4LH3Rp1WrCz53m3; Mon, 6 Jun 2022 19:28:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654543686; 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=xCavq7XDybQ/yokEdmxVFuZYK8kWxbpxNFWr1CqxM8M=; b=Kj/Y/lgEuw0yZEAj2DIjXcbtMe5jSVAPuJADGGbr0fVBGjT7LBCdr0a/wd/ANJhnbkqNpe 2u7RbQxBf3WGtEEwpgz8ry49IYYoG+wRNX91z06T5eTiBTeHW8o4ppqEzX4fzZ42I7+KwU GQn79Y/s1NzDfGkpXjMf8cBaOKgPR6NTyaMaAd6xyXKWMKv7eKF0r1mLsXAOKkrPQgRm7w tRcgr6xbvtsbO+ws3lr1kT/HI0LY/Yn72rvP8a9H1nemoFqbSQgztkLmhN1/t4ehoo9iel kYztAd6nRfOPFEDbLOv2m3/BGN9xB0/fDK+IYVHprU3UDalNumtKFX20+dAF8g== 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 0334E43C6; Mon, 6 Jun 2022 19:28:06 +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 256JS5ri077026; Mon, 6 Jun 2022 19:28:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 256JS5R1077025; Mon, 6 Jun 2022 19:28:05 GMT (envelope-from git) Date: Mon, 6 Jun 2022 19:28:05 GMT Message-Id: <202206061928.256JS5R1077025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 156745b42d9e - main - fdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 156745b42d9e6dfa3d9c6dc480db7836683850cf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654543686; 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=xCavq7XDybQ/yokEdmxVFuZYK8kWxbpxNFWr1CqxM8M=; b=wUV1TVsh8JeAiuigsee7EkTTFYvSXFTibhQzCgx6js14prWVkVKxbWUfljU5V3JDjEzgqr Urz9K4fiANQoZ6xvXfjibOpZ8BO0l0E/Gbyei9x0PuHeQKnMZ2LIGG1/94gN/SIlZgUD1E Ju0YzQniewHIecsGHQRFM7qO9aGPbEitwJajnHtDpGSQDZ1bU/9gEUKKU5aj8r9xn5Izvq QTsm301t4MMhNJDBYCK2oiCZr7hHBkV9Pwh5krJ8jSxFdXUhw5v7N4BJwR/BQPft+Gxi1t g02XRD/BxqvHItHyvxAX3wcfmAWF4OLH2n15nfmwbFJKob2SP/X1HmfHicQCWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654543686; a=rsa-sha256; cv=none; b=jKPTwrAnSGyaa+sMsAgtXKe8tnzWpyU+fhn5MMK6PQBoV77ji/Rtm2znfgilq44PcT6myS NIqpSUc/xhN70/5TBgsNzeXuuu3EED4J9xculREebM16blziaVrOWElzoYaoEAzPUyH/ca 6GV556qb7JD5wrrLX8j4uY9n1HsjaR65K+21/S+JIypL2i01BhPhzHy8oK3jnmAZq3BycZ 7moRJJaHVydU9OUMoyDMXwipGTDBvysy3P5YVysfo7cv/q1T5pDQOQtuZLMxhL03p+E4Rk 9/ekjkSwKBYYdQttG5yJ+I7W5LUNin3cvmQYLzlr13Q+DTIwZ8yz7I94IKQ1pA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=156745b42d9e6dfa3d9c6dc480db7836683850cf commit 156745b42d9e6dfa3d9c6dc480db7836683850cf Author: Konstantin Belousov AuthorDate: 2022-06-05 18:49:09 +0000 Commit: Konstantin Belousov CommitDate: 2022-06-06 19:27:36 +0000 fdescfs: allow chown/utime etc on fdescfs fd for underlying files opened with O_PATH Reported and tested by: dchagin Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35410 --- sys/fs/fdescfs/fdesc_vnops.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 2fbdcac34583..ae6d60d0fc55 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -492,9 +492,15 @@ fdesc_setattr(struct vop_setattr_args *ap) /* * Allow setattr where there is an underlying vnode. + * For O_PATH descriptors, disallow truncate. */ - error = getvnode(td, fd, - cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); + if (vap->va_size != VNOVAL) { + error = getvnode(td, fd, + cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); + } else { + error = getvnode_path(td, fd, + cap_rights_init_one(&rights, CAP_EXTATTR_SET), &fp); + } if (error) { /* * getvnode() returns EINVAL if the file descriptor is not