From nobody Sat Oct 08 00:39:09 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 4MkmWx404Bz4fG3Q; Sat, 8 Oct 2022 00:39:09 +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 4MkmWx32bVz3pFl; Sat, 8 Oct 2022 00:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665189549; 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=2AhJchIyOGfeGCySuYmHeE6R3bVcCZZOs1xNdHrEuiI=; b=CGjJ5Qd+ra3E0Kf56galrlnhvfcAP/M2gQDm6SYzp0DN4Q/5CPRmubQlZDh3+WEiPYwX3z I+O779EKYF7TVAPFS46eBg5+l9cj/YgagVuQSk/2kGmYQB90LCTDvxU5dVV3V5+8aOGPtQ OIRa8g+CwCmclCZMJTmeWjEKkBRXztqNp5/pleUDQbdT6TTdj/HQvShOTDKnBc18nD9c60 +ql66qSTwETD98HaPtrUiTW9xwRnOpSs9yX2G4LbaAD6IfZv/Ikz7alUNur0RaUnk4Szsh NygwUocyYB8HLZftWswFYDy14qpRdGw3Z+C48t/HaoxfQN7X0YGTD5rqZtuCjQ== 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 4MkmWx2538zmQg; Sat, 8 Oct 2022 00:39:09 +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 2980d99e034357; Sat, 8 Oct 2022 00:39:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2980d9ri034356; Sat, 8 Oct 2022 00:39:09 GMT (envelope-from git) Date: Sat, 8 Oct 2022 00:39:09 GMT Message-Id: <202210080039.2980d9ri034356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 064d5d4dee05 - stable/13 - tmpfs: disallow truncation to set file size past RLIMIT_FSIZE 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 064d5d4dee053f70ff82f9a1f98ed42e38f36b47 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665189549; 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=2AhJchIyOGfeGCySuYmHeE6R3bVcCZZOs1xNdHrEuiI=; b=YpE+COHAF60RudJhdSECrzjE64NJ+mnJHxzI5EITtM1ab+u4cfGOpWx2Vmbk5BmduyVc+4 INzoBpvO75PnH1EjZ4V84xsE2o0irjE5KCszCvTgHxs+EAMb/7DVcYc1MlHzv0yR9/kt6C EN6xuYHUqceEfYRMwnOmnkgE3ealS1o4O1/9se44w/Amhl+Xd3cM7llpY9nMwaR0t7Zgtk kO046NFsse2w3CYcfXeLD1QN+N2mh/VDvGPAE4w04LHj4yX9A2H7yH+iIj2ckPTCNsHlmg enl/r5suMoAEPS4z0VFAI9b/E9/pjnZ+FjRWlFmToLgF9Ep9CiIxAydAUNP27Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665189549; a=rsa-sha256; cv=none; b=gItDr9mY0vsoXoGIbDgUmT+Jg1WhC7wmlHV1FppVdzLmKcdDHvrm0C66PpEfV7Sji/LWB7 CYcCkhWK5p5ZIlcWZ6RuNZp06q4mD4W9MqR3DyiRQe8TVPoz2o0dtm9kDS5pm5lWNFmfiv FOvf1vjP6HxDlLrGmv/ibrHws9RzFyKnoNI/H9BpzRlUZrxY7DIIVEEBkc3aixM5QtT1Tu +w57257ELweTA+uspihnfc/sVy64Jtv9oXJEdDsG81h6ywXHHWzjKu40tUKn+Ybq9LOmu7 sHdsfU2vDdVwEeX+rncmTfGdEXKWIp8aT9saf3fy8ISEHgF+pQecFnQ69IO5YA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=064d5d4dee053f70ff82f9a1f98ed42e38f36b47 commit 064d5d4dee053f70ff82f9a1f98ed42e38f36b47 Author: Konstantin Belousov AuthorDate: 2022-09-18 13:28:11 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-08 00:29:35 +0000 tmpfs: disallow truncation to set file size past RLIMIT_FSIZE PR: 164793 (cherry picked from commit b5b16659c5aceb9caa0a9b76c7746e1d12a505ce) --- sys/fs/tmpfs/tmpfs_subr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 6c8d9bd9a0ff..f60dc81c648c 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -2045,6 +2045,10 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct ucred *cred, if (node->tn_flags & (IMMUTABLE | APPEND)) return (EPERM); + error = vn_rlimit_trunc(size, td); + if (error != 0) + return (error); + error = tmpfs_truncate(vp, size); /* * tmpfs_truncate will raise the NOTE_EXTEND and NOTE_ATTRIB kevents