From nobody Sat Sep 24 16:42:34 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 4MZZZ23jShz4d3Dc; Sat, 24 Sep 2022 16:42:34 +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 4MZZZ221ykz3GPK; Sat, 24 Sep 2022 16:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037754; 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=kZ18JcIF/apu5u65ryuuSMaC6VIwPzTMZfDRQPFM52k=; b=gkAx04VF//9ruAVLVZuRobYJS+dPDfmXb7PMNQXm/Z/sI4yxl4TD/7lg6+ry7wmYDwQS5c S9eQGYy2R61OlN6vgVCOg9F80FpcR/7URAzt9ermRty4V3fQELqPA2KJvyHDAwpTCxfNx8 vS/lIQksDmZeT8ifNPogswgzIrN4ywuyMO5ZOGONWU19qih9pNSZK4qKpf2fgCDiOVC1mA sZoGC73JUhKGpLEXqtYwn53CzNjA//GEQ9LZDnx+lwO91aVeBilattSFOUmocygfWCsUve onsqKhp0kitz8xpP+pSl9j9Smz045AjHStB8OXvl7ykwopszInqik7HQdHOAMw== 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 4MZZZ20sJPz17jc; Sat, 24 Sep 2022 16:42:34 +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 28OGgYD8058054; Sat, 24 Sep 2022 16:42:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28OGgY5J058053; Sat, 24 Sep 2022 16:42:34 GMT (envelope-from git) Date: Sat, 24 Sep 2022 16:42:34 GMT Message-Id: <202209241642.28OGgY5J058053@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: 70385088cafa - main - UFS: 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: 70385088cafaab3365c5243f22b8fc9c712c1fde Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037754; 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=kZ18JcIF/apu5u65ryuuSMaC6VIwPzTMZfDRQPFM52k=; b=uzzj6FB8gUK3+IT4WXbz9aMN7Y4msVx605PVeTdmWm8K/RONB5iHr7YBJHg/csgQqzZ67f Mc6wdXmYp/HJgOm5LctMz5o3bIv51CoQGZNnMKDE5QagsW6J11E46dlSVvWEZbPx2ia2Zh vfDHVZBepQHvp2dqpbf4Rclbj1fnphFWReBFwn/6fSoK4Lwkg4fOiwhGSe1w/yHsPPV+Ds UOUFyKxeNQJnazNFpR18wlfemrfK7xTSyJIhkGvvoL3bVaDCO36l39PZSOzSzgWe0FZ8LF bnsyqZ7T6RsGzp5U7i2v0yFIPCC/F3HC1xxAppqbXARSY3baSVKd4/RKY8hVsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664037754; a=rsa-sha256; cv=none; b=eKW3SFA/R5qjnVd0QOIXjtrVGgeNu+S16sGbenRpFlLFSl61rBq/AlUT0sj8AhAFfnQku1 vpo7/7oqdK/UhzXEe/AaIgvN7TEW3KEvLcmqJufWR51J6D2nRmxw3jFBGjnf/OIihJPxGO TvCydgcdOeW2FP0Wb1edpqbHZIU4ncJGkS9SgtvxuFI94v8IT6vH89ZK59HYQLb3XXosIi KxS+eS0LAWZ2Avn387h7+ak/XOQrXBdw/VBLqoMZxp3jdewn/zH4VAuo0fcPjs4ax7d849 106TPVPfCfOzGpCXmLn9xCwysXb3g9VlpLrTPSAtTGwJAupnDTZm+wv9Bol5zw== 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=70385088cafaab3365c5243f22b8fc9c712c1fde commit 70385088cafaab3365c5243f22b8fc9c712c1fde Author: Konstantin Belousov AuthorDate: 2022-09-18 11:49:57 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-24 16:41:22 +0000 UFS: disallow truncation to set file size past RLIMIT_FSIZE This is mandated by POSIX. 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/ufs/ufs/ufs_vnops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index cf101ae50750..9ea38bc149a5 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -755,6 +755,9 @@ ufs_setattr( */ return (0); } + error = vn_rlimit_trunc(vap->va_size, td); + if (error != 0) + return (error); if ((error = UFS_TRUNCATE(vp, vap->va_size, IO_NORMAL | ((vap->va_vaflags & VA_SYNC) != 0 ? IO_SYNC : 0), cred)) != 0)