]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] spufs: Respect RLIMIT_CORE in spu coredump code
authorMichael Ellerman <michael@ellerman.id.au>
Wed, 19 Sep 2007 04:38:12 +0000 (14:38 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 19 Sep 2007 05:12:19 +0000 (15:12 +1000)
Currently the spu coredump code doesn't respect the ulimit, it should.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/cell/spufs/coredump.c

index 6b8aef6d7e688217a292cc3ee7c5d2d5d89b0e18..80f62363e1ce1708c19662fa003bebc9b5459a72 100644 (file)
@@ -53,8 +53,12 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
  */
 static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
 {
+       unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
        ssize_t written;
 
+       if (*foffset + nr > limit)
+               return -EIO;
+
        written = file->f_op->write(file, addr, nr, &file->f_pos);
        *foffset += written;