[Cbe-oss-dev] [PATCH 24/25] spufs: Respect RLIMIT_CORE in spu coredump code
Jeremy Kerr
jk at ozlabs.org
Tue Sep 18 14:36:50 EST 2007
From: Michael Ellerman <michael at ellerman.id.au>
Currently the spu coredump code doesn't respect the ulimit, it should.
Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
arch/powerpc/platforms/cell/spufs/coredump.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 6b8aef6..80f6236 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -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;
More information about the cbe-oss-dev
mailing list