git: 70385088cafa - main - UFS: disallow truncation to set file size past RLIMIT_FSIZE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 24 Sep 2022 16:42:34 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=70385088cafaab3365c5243f22b8fc9c712c1fde commit 70385088cafaab3365c5243f22b8fc9c712c1fde Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-09-18 11:49:57 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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)