Re: [RFC PATCH] coredump: fix incomplete core file created when dump_skip was used last

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/22, Victor Kamensky wrote:
>
> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -664,6 +664,14 @@ void do_coredump(const siginfo_t *siginfo)
>         if (!dump_interrupted()) {
>                 file_start_write(cprm.file);
>                 core_dumped = binfmt->core_dump(&cprm);
> +               /*
> +                * If last operation was dump_skip with llseek, we need to
> +                * truncate file up to f_pos to match expected size.
> +                */
> +               if (!ispipe &&
> +                   (cprm.file->f_pos > i_size_read(file_inode(cprm.file))))
> +                       do_truncate(cprm.file->f_path.dentry,
> +                                   cprm.file->f_pos, 0, cprm.file);
>                 file_end_write(cprm.file);
>         }
>         if (ispipe && core_pipe_limit)
>
> May I use your name with Suggested-by tag?

Sure, thanks ;)

I'd suggest to add a simple helper, but I won't insist. And perhaps the
caller can also check "core_dumped" along with !ispipe, but this is
purely cosmetic.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux