Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Sep 2022 16:43:16 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 164793] [kern] RLIMIT_FSIZE does not work, affecting ftruncate(2) and truncate(2)
Message-ID:  <bug-164793-99-ismZLc7uL7@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-164793-99@https.bugs.freebsd.org/bugzilla/>
References:  <bug-164793-99@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <kib@FreeBSD.org>
AuthorDate: 2022-09-18 11:46:19 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-164793-99-ismZLc7uL7>