linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Victor Kamensky <victor.kamensky@linaro.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] coredump: fix incomplete core file created when dump_skip was used last
Date: Thu, 23 Oct 2014 18:39:34 +0200	[thread overview]
Message-ID: <20141023163934.GA31508@redhat.com> (raw)
In-Reply-To: <CAA3XUr0N_fcOqmSnT2Y=Dz+5uH1YN+qrJ=2-fJrQaHcnu1cQXw@mail.gmail.com>

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.

      reply	other threads:[~2014-10-23 16:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 22:57 [RFC PATCH] coredump: fix incomplete core file created when dump_skip was used last Victor Kamensky
2014-10-21 22:57 ` Victor Kamensky
2014-10-22 16:55   ` Oleg Nesterov
2014-10-22 23:21     ` Victor Kamensky
2014-10-23 16:39       ` Oleg Nesterov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141023163934.GA31508@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=victor.kamensky@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).