From nobody Sat Sep 24 16:42:36 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 4MZZZ45bM7z4d3Gw; Sat, 24 Sep 2022 16:42:36 +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 4MZZZ43nSsz3Gbr; Sat, 24 Sep 2022 16:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037756; 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=YJAkWQ/+TqO0CjNfoLBYH0sCOcwvd8R3+Kmft2Kp9S4=; b=LY+zMOQN2FfS+Lcz8mMUXWr2dZjILzlmmTbkCax4azIDyY758s79ZQ0HtJzqbbZITx6qwV 8ee252/+flkWgoR14GxcuchbjbX382BQOP0S1Os6vCmoxRC2jS8tEYLT+/a7Yp7Y3qhcYh 2f/ntp63c/haVMW+vkDVOlPnp7HCOHiyU77FCo/G+2O0oqqimy/dZ+LV+mTM0UQd7qbkaZ Bd9Aah0UYI9NJ/Qy0tGdUksSdryZ478PaodC4LO9k50XjtFgVe6V1MnY8hDeBqn+aqHi7r nmLPvU9Vjnox8bANqM+/2/mwrh3ulz0LBZWF7ANGNmRArY9X0TWTOeZWonThoQ== 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 4MZZZ42Vf6z17sK; Sat, 24 Sep 2022 16:42:36 +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 28OGgaU0058119; Sat, 24 Sep 2022 16:42:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28OGgaQr058118; Sat, 24 Sep 2022 16:42:36 GMT (envelope-from git) Date: Sat, 24 Sep 2022 16:42:36 GMT Message-Id: <202209241642.28OGgaQr058118@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: b5b16659c5ac - main - 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/main X-Git-Reftype: branch X-Git-Commit: b5b16659c5aceb9caa0a9b76c7746e1d12a505ce Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037756; 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=YJAkWQ/+TqO0CjNfoLBYH0sCOcwvd8R3+Kmft2Kp9S4=; b=HLJxd1X1ZW+xi1lDwX9+LuyRqLGRF5WlBOBByTLFGLC1y03Ry48KTU/ldiaLk5aNw1KbQ+ 59Nz56o4iv8cr8oXiyK+cQ2lowIzA33lvMPIxESa7FWBQTUerUN+vIPxhjiSdmCN6NFp/+ g0BVXlLJ7nxFgXaAOx68hInpToI35hH3FAkoqwrxc+Un1wRdkhfX8IxWO3QRo/7jSqhEzv NkrLtCJNYjMhMWUZL/k93pRHKBgPC+FJpAtxEUN3S9vqDHOUgCzleN/Qtx+MCvzqTFLWhB /ff4uESV+e/KZ38zcDpvC6KPax/Beu4m3JDLY2+Nhbub3kYoaKEJPFywdTgnDw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664037756; a=rsa-sha256; cv=none; b=Vr38bQU9J/K6R8HwsfC8aCnUlOFia6JtUQw3s+HY1bWhTNpQmNPF1PWCfINjyLup0QacAF NKJy2yA2fBOm54jqbDmkz9XMCKt7abdgc9ycgFoRcCxvq+hhS29mNTPQ3Z18hC9sxTt21S urTsp40oj37jLlN84BKSAbVwNJlGJuy5OIBdtgjGAGDw3iIL1ackhp5q8lt6N5sWkz5FNO DxiOcr9QYH/GVnKt9oM1r2LPXCHbteksfbuDWQ8/Y/Q/H0/8XE174t36dEaSuFG1SNc1eP yNS8ux6ieTbpfFA4ug5dLHEyYnYF/dOIhDV5TGXGLCiLVyyP4qaifBmpns6YUQ== 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=b5b16659c5aceb9caa0a9b76c7746e1d12a505ce commit b5b16659c5aceb9caa0a9b76c7746e1d12a505ce Author: Konstantin Belousov AuthorDate: 2022-09-18 13:28:11 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-24 16:41:30 +0000 tmpfs: disallow truncation to set file size past RLIMIT_FSIZE PR: 164793 Reviewed by: asomers, jah, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36625 --- 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 be1eef1c3d89..7d589b1c193d 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -2120,6 +2120,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