All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [git pull] vfs.git pile 11
Date: Thu, 6 Jul 2017 22:20:14 +0100	[thread overview]
Message-ID: <20170706212014.GZ10672@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20170706202927.GX10672@ZenIV.linux.org.uk>

On Thu, Jul 06, 2017 at 09:29:27PM +0100, Al Viro wrote:
> On Thu, Jul 06, 2017 at 09:18:26PM +0100, Al Viro wrote:
> > On Thu, Jul 06, 2017 at 12:45:36PM -0700, Kees Cook wrote:
> > > 
> > > +   if (unlikely(!check_copy_size(addr, bytes, false)))
> > > +       return false;
> > > +   else
> > > +       return _copy_from_iter_full(addr, bytes, i);
> > > 
> > > Can these be rewritten to avoid the double-negative?
> > 
> > Matter of taste - I've no strong preferences here.
> > 
> > > +   might_fault();
> > > 
> > > Should this be might_sleep()? Just from reading the patch it looked
> > > like you were adding might_sleep()s in the other cases.
> > 
> > D'oh - shouldn't have written that pull request message before the
> > first cup of coffee...  might_sleep() it is, of course.
> 
> Hrm...  Said that, might_sleep() doesn't check one thing might_fault()
> does - the
> #if defined(CONFIG_DEBUG_ATOMIC_SLEEP)
>         if (current->mm)
>                 might_lock_read(&current->mm->mmap_sem);
> #endif
> thing.  Let me think a bit...

FWIW,
	* with iovec-backed, any of those primitives under pagefault_disable()
is seriously wrong.  To the point where we probably want to complain when
called that way.  That, of course, needs to be checked at the outermost level -
the primitives might do pagefault_disable() internally; that's fine.  Outside
caller doing that under pagefault_disable() isn't.
	* uaccess_kernel() (== set_fs(KERNEL_DS)) has nothing to do with it.
If anything, we should not do copyin/copyout on iovec-backed ones with that
present.
	* telling lockdep that we might end up grabbing ->mm->mmap_sem, OTOH,
is the right thing to do.  In addition to might_sleep().

Linus, could you hold that one back until tomorrow?  I want to tweak the
last commit in there a bit, but I want to give it a local beating first...

  reply	other threads:[~2017-07-06 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  9:12 [git pull] vfs.git pile 11 Al Viro
2017-07-06 19:45 ` Kees Cook
2017-07-06 20:18   ` Al Viro
2017-07-06 20:29     ` Al Viro
2017-07-06 21:20       ` Al Viro [this message]
2017-07-07  5:09         ` Linus Torvalds

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=20170706212014.GZ10672@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.