linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jan Kara <jack@suse.cz>
Cc: Jan Kara <jack@suse.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	Al Viro <viro@ZenIV.linux.org.uk>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH] mm: Make sendfile(2) killable
Date: Fri, 16 Oct 2015 14:05:16 -0700	[thread overview]
Message-ID: <20151016140516.8b6e1a10cb06fdd15e60320b@linux-foundation.org> (raw)
In-Reply-To: <20151016064027.GA22182@quack.suse.cz>

On Fri, 16 Oct 2015 08:40:27 +0200 Jan Kara <jack@suse.cz> wrote:

> > >  		balance_dirty_pages_ratelimited(mapping);
> > > -		if (fatal_signal_pending(current)) {
> > > -			status = -EINTR;
> > > -			break;
> > > -		}
> > >  	} while (iov_iter_count(i));
> > >  
> > >  	return written ? written : status;
> > 
> > This won't work, will it?  If user hits ^C after we've written a few
> > pages, `written' is non-zero and the same thing happens?
> 
> It does work - I've tested it :). Sure, the generic_perform_write() call
> that is running when the signal is delivered will return with value > 0.
> But the interesting thing is what happens after that: Either we return to
> userspace (and then we are fine) or generic_perform_write() gets called
> again because there's more to write and *that* call will return -EINTR
> which ends up terminating the whole sendfile syscall.

OK.  I guess that's better behaviour than overwriting a non-zero
`written' when signalled.

I'm going to tag this one for -stable.  It's a bit of a DoS.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2015-10-16 21:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 12:45 Jan Kara
2015-10-15 20:46 ` Andrew Morton
2015-10-16  6:40   ` Jan Kara
2015-10-16 21:05     ` Andrew Morton [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=20151016140516.8b6e1a10cb06fdd15e60320b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.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