Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e25ae6d authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras
Browse files

[POWERPC] spufs: Respect RLIMIT_CORE in spu coredump code



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

Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 7af1443a
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -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)
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;
	ssize_t written;


	if (*foffset + nr > limit)
		return -EIO;

	written = file->f_op->write(file, addr, nr, &file->f_pos);
	written = file->f_op->write(file, addr, nr, &file->f_pos);
	*foffset += written;
	*foffset += written;