From nobody Sat Sep 24 16:43:16 2022 X-Original-To: standards@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 4MZZZr5xjXz4d3Y7 for ; Sat, 24 Sep 2022 16:43:16 +0000 (UTC) (envelope-from bugzilla-noreply@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 4MZZZr4qQ7z3Klv for ; Sat, 24 Sep 2022 16:43:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4MZZZr3w6Hz180c for ; Sat, 24 Sep 2022 16:43:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 28OGhGmc019696 for ; Sat, 24 Sep 2022 16:43:16 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 28OGhGvM019695 for standards@FreeBSD.org; Sat, 24 Sep 2022 16:43:16 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: standards@FreeBSD.org Subject: [Bug 164793] [kern] RLIMIT_FSIZE does not work, affecting ftruncate(2) and truncate(2) Date: Sat, 24 Sep 2022 16:43:16 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: standards X-Bugzilla-Version: 9.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: standards@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Standards compliance List-Archive: https://lists.freebsd.org/archives/freebsd-standards List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-standards@freebsd.org X-BeenThere: freebsd-standards@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664037796; 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: in-reply-to:in-reply-to:references:references; bh=PZLR5FDJfjEtdyrAh8p5rMqrNyQcMYnjw68m2BD7WfE=; b=JD2FkKiU8RKSSSrZ7QaZBaiMt8hOrC/4dX3cRUIrGoYYZTRNyBdXYgbtti9bDLGkkqWmH1 BknwKS0qtQcs2aCKrzsCB9K10SrIinesNfBTTIsi+fxoZXGtVFVlpJH9/d8b3sOrhkMDel 33vmKKcwTO+K10IgXxr+4gYcixyMX4LwJj4XjeDYIOZftloDp9kLLFLI+IeHzUlRgjj+XU yzJPXWvOYfIM4SghtyLpjtUoEnTHo6/RNqhSnUsJeVIK0ac2trvgPwjpV51EjQNeD2Jo8t 6cag1YnYVlJ6tdAnP0p19v9QS1VSRAfRfOgpPng3el2SznX6wk+h9echm7Nb/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664037796; a=rsa-sha256; cv=none; b=w5kC2Gm36Mzu6GOEJCZf8V8LPycmNA2DgI7eqgOaGQkZ37qsqAyCQqjS1+FqFEUG9xNZqy JSiaFCHtuEDjXettNtENZqYkYOYVTqyhBexDPBV0ncH5a+fvY4pgxaHgMc/nte2HKzaKd2 m02B70mknnOPXV2vkf4BAIxDz1oxCDUbgmQAz2VYLFUwDM2m2IMdaYX2O4PTs0+dmwgHuW 6AxaOAwn15/9MzBAcNnaBTK8D2Lb8j3bjyMtdn8DKPxyGw5AP+Pad8yvUryxGtABgRiswE fQDmMMg1R6QyMSzLqnK+qKntLNk8v3D2qX0I2lv55raqFX1DdVtTemJPjMp0wA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D164793 --- Comment #11 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D1b4b75171ee3f2213b7671878a910fd5d= db3306e commit 1b4b75171ee3f2213b7671878a910fd5ddb3306e Author: Konstantin Belousov AuthorDate: 2022-09-18 11:46:19 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-24 16:41:33 +0000 Add vn_rlimit_fsizex() and vn_rlimit_fsizex_res() The vn_rlimit_fsizex() function: - checks that the write does not exceed RLIMIT_FSIZE limit and fs maximum supported file size - truncates write length if it exceeds the RLIMIT_FSIZE or max file siz= e, but there are some bytes to write - sends SIGXFSZ if RLIMIT_FSIZE would be exceed otherwise POSIX mandates the truncated write in case when some bytes can be written but whole write request fails the RLIMIT_FSIZE check. The function is supposed to be used from VOP_WRITE()s. Due to pecularity in the VFS generic write syscall layer, uio_resid must correctly reflect the written amount (noted by markj). Provide the dual vn_rlimit_fsizex_res() function to correct uio_resid after the clamp done in vn_rlimit_fsizex() on VOP_WRITE() return. 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/kern/vfs_vnops.c | 92 +++++++++++++++++++++++++++++++++++++++++++++---= ---- sys/sys/vnode.h | 3 ++ 2 files changed, 83 insertions(+), 12 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=