login
Header Space

 
 

[PATCH 14/15] Respect RLIMIT_CORE in spu coredump code

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linuxppc-dev@...>
Cc: Jeremy Kerr <jk@...>, <linux-kernel@...>
Date: Wednesday, September 12, 2007 - 3:43 am

Currently the spu coredump code doesn't respect the ulimit, it should.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/cell/spufs/coredump.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index c3b5cd5..b8ab2c6 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;
 
-- 
1.5.1.3.g7a33b

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 14/15] Respect RLIMIT_CORE in spu coredump code, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Michael Ellerman, (Wed Sep 12, 3:43 am)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Michael Ellerman, (Wed Sep 12, 3:49 am)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Arnd Bergmann, (Wed Sep 12, 4:47 am)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Michael Ellerman, (Wed Sep 12, 10:05 pm)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Arnd Bergmann, (Thu Sep 13, 8:17 am)
[PATCH 11/15] Combine spufs_coredump_calls with spufs_calls, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 12/15] Cleanup ELF coredump extra notes logic, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 10/15] Add contents of npc file to SPU coredumps, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 05/15] Write some SPU coredump values as ASCII, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 02/15] Remove ctx_info and ctx_info_list, Michael Ellerman, (Wed Sep 12, 3:43 am)
speck-geostationary