From c1e466089148d8e00bcf277c18f13c056deea6d6 Mon Sep 17 00:00:00 2001 From: Pedro Martelletto Date: Mon, 26 Feb 2007 11:25:24 +0000 Subject: Don't enforce RLIMIT_FSIZE on vnd(4) I/O operations, okay deraadt@ --- sys/dev/vnd.c | 10 +++++++--- sys/sys/vnode.h | 3 ++- sys/ufs/ffs/ffs_vnops.c | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index da2c15b60f4..2e8c3e37640 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.69 2007/02/21 19:25:40 grunk Exp $ */ +/* $OpenBSD: vnd.c,v 1.70 2007/02/26 11:25:23 pedro Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -461,8 +461,12 @@ vndstrategy(struct buf *bp) vndencrypt(vnd, bp->b_data, bp->b_bcount, bp->b_blkno, 1); auio.uio_rw = UIO_WRITE; - bp->b_error = VOP_WRITE(vnd->sc_vp, &auio, 0, - vnd->sc_cred); + /* + * Upper layer has already checked I/O for + * limits, so there is no need to do it again. + */ + bp->b_error = VOP_WRITE(vnd->sc_vp, &auio, + IO_NOLIMIT, vnd->sc_cred); /* Data in buffer cache needs to be in clear */ if (vnd->sc_keyctx) vndencrypt(vnd, bp->b_data, diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 099fa665797..2940b85303d 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.73 2007/01/16 17:52:18 thib Exp $ */ +/* $OpenBSD: vnode.h,v 1.74 2007/02/26 11:25:23 pedro Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -187,6 +187,7 @@ struct vattr { #define IO_SYNC 0x04 /* do I/O synchronously */ #define IO_NODELOCKED 0x08 /* underlying node already locked */ #define IO_NDELAY 0x10 /* FNDELAY flag set in file table */ +#define IO_NOLIMIT 0x20 /* don't enforce limits on i/o */ /* * Modes. Some values same as Ixxx entries from inode.h for now. diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index c0c8f9ecd42..248ad3754ca 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.41 2007/01/16 17:52:18 thib Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.42 2007/02/26 11:25:23 pedro Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -332,7 +332,7 @@ ffs_write(void *v) * file servers have no limits, I don't think it matters. */ p = uio->uio_procp; - if (vp->v_type == VREG && p && + if (vp->v_type == VREG && p && !(ioflag & IO_NOLIMIT) && uio->uio_offset + uio->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { psignal(p, SIGXFSZ); -- cgit v1.2.3