Re: [PATCH RESEND] coredump: Ensure proper size of sparse core files

From: David Miller
Date: Mon Jan 16 2017 - 22:44:24 EST


From: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>
Date: Wed, 11 Jan 2017 13:25:00 -0600

> If the last section of a core file ends with an unmapped or zero page,
> the size of the file does not correspond with the last dump_skip() call.
> gdb complains that the file is truncated and can be confusing to users.
>
> After all of the vma sections are written, make sure that the file size
> is no smaller than the current file position.
>
> This problem can be demonstrated with gdb's bigcore testcase on the
> sparc architecture.
>
> Signed-off-by: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>

The lseek() done by dump_skip() should extend the file properly.

Otherwise, everyone would be seeing this problem.

That test case passed all the time when I was last running the GDB
testsuite all the time on sparc64, say 5 years ago.