summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-02-26 11:25:24 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-02-26 11:25:24 +0000
commitc1e466089148d8e00bcf277c18f13c056deea6d6 (patch)
treeea1d206f496e59232abc60ef576e0b369d31d4b2
parent96bd43d21d340a98c5ae79ba36f6a369d5e9b63c (diff)
Don't enforce RLIMIT_FSIZE on vnd(4) I/O operations, okay deraadt@
-rw-r--r--sys/dev/vnd.c10
-rw-r--r--sys/sys/vnode.h3
-rw-r--r--sys/ufs/ffs/ffs_vnops.c4
3 files changed, 11 insertions, 6 deletions
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);