All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>
Subject: Re: [git pull] uaccess-related bits of vfs.git
Date: Sat, 13 May 2017 18:00:56 +0100	[thread overview]
Message-ID: <20170513170056.GX390@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+55aFzrcX=B-m5SN1ajEopKbTLj1WcpKZWgdDTwYqoOBPJwaQ@mail.gmail.com>

On Sat, May 13, 2017 at 09:15:07AM -0700, Linus Torvalds wrote:
> > IOW, we have
> >         * most of users in arch/* (heavily dominated by signal-related code,
> > both loads and stores).  Those need careful massage; maybe unsafe-based
> > solution, maybe something else, but it's obviously per-architecture work
> > and these paths are sensitive.
> 
> Why are they sensitive?

Because there we do have tons of back-to-back __get_user() (on sigreturn())
or __put_user() (on signal setup).

> Why not just do this:
> 
>   git grep -l '\<__\(\(get\)\|\(put\)\)_user(' -- arch/x86
> :^arch/x86/include/asm/uaccess.h
>         | xargs sed -i 's/__\(\(\(get\)\|\(put\)\)_user(\)/\1/g'
> 
> which converts all the x86 uses in one go.

x86 actually tends to use get_user_ex/put_user_ex instead.

> Anybody who *relies* on not checking the address_limit is so broken as
> to be not even funny.

Except for open-coded probe_kernel_read() somewhere in arch/*; I have not
read through those 700+ callers, so I don't know if there's any such.
Sure, those won't be performance-sensitive.

> And anything that is so performance-sensitive
> that anybody can even measure the effect of the above we can convert
> later.

> Sure, do it in pieces (eg each architecture separately, then
> "drivers", then "networking", then whatever, until all done), just so
> that *if* something actually depends on semantics (and that really
> shouldn't be the case), we have at least some information from a
> bisect.
>
> But I don't see the excuse for not just doing it. If nobody notices,
> it's an obvious improvement. And if somebody *does* notice, we know
> how to do it properly with unsafe_xyz_user(), because "__xyz_user()"
> most definitely isn't it.

I think we ought to actually look through those places - there are few
enough of them (outside of arch/, that is) and stac/clac overhead is
not the only problem they tend to have.

  parent reply	other threads:[~2017-05-13 17:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01  3:02 Linux 4.11 Linus Torvalds
2017-05-01  3:45 ` [git pull] uaccess-related bits of vfs.git Al Viro
2017-05-13  1:00   ` Linus Torvalds
2017-05-13  6:57     ` Al Viro
2017-05-13 12:05       ` Adam Borowski
2017-05-13 13:46         ` Brian Gerst
2017-05-13 13:46           ` Brian Gerst
2017-05-13 16:46         ` Al Viro
2017-05-13 16:15       ` Linus Torvalds
2017-05-13 16:17         ` Linus Torvalds
2017-05-13 17:00         ` Al Viro [this message]
2017-05-13 17:12           ` Al Viro
2017-05-13 17:18           ` Linus Torvalds
2017-05-13 18:04             ` Al Viro
2017-05-13 18:26               ` Al Viro
2017-05-13 19:11                 ` Al Viro
2017-05-13 19:34                   ` Al Viro
2017-05-13 19:00               ` Linus Torvalds
2017-05-13 19:17                 ` Al Viro
2017-05-13 19:56                 ` Al Viro
2017-05-13 20:08                   ` Al Viro
2017-05-13 20:32                     ` Geert Uytterhoeven
2017-05-13 20:32                       ` Geert Uytterhoeven
2017-05-13 20:45                       ` Al Viro
2017-05-13 20:37                 ` Al Viro
2017-05-13 20:52                   ` Linus Torvalds
2017-05-13 21:25                     ` Al Viro
2017-05-14 18:13         ` Ingo Molnar
2017-05-14 18:57           ` Al Viro

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=20170513170056.GX390@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-arch@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.