netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Michael S. Tsirkin'" <mst@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Jason Wang <jasowang@redhat.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>
Subject: RE: [PATCH RFC] uaccess: user_access_begin_after_access_ok()
Date: Tue, 2 Jun 2020 20:41:38 +0000	[thread overview]
Message-ID: <950896ceff2d44e8aaf6f9f5fab210e4@AcuMS.aculab.com> (raw)
In-Reply-To: <20200602162931-mutt-send-email-mst@kernel.org>

From: Michael S. Tsirkin
> Sent: 02 June 2020 21:33
> On Tue, Jun 02, 2020 at 10:18:09AM -0700, Linus Torvalds wrote:
> > On Tue, Jun 2, 2020 at 9:33 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > >
> > > > It's not clear whether we need a new API, I think __uaccess_being() has the
> > > > assumption that the address has been validated by access_ok().
> > >
> > > __uaccess_begin() is a stopgap, not a public API.
> >
> > Correct. It's just an x86 implementation detail.
> >
> > > The problem is real, but "let's add a public API that would do user_access_begin()
> > > with access_ok() already done" is no-go.
> >
> > Yeah, it's completely pointless.
> >
> > The solution to this is easy: remove the incorrect and useless early
> > "access_ok()". Boom, done.
> 
> Hmm are you sure we can drop it? access_ok is done in the context
> of the process. Access itself in the context of a kernel thread
> that borrows the same mm. IIUC if the process can be 32 bit
> while the kernel is 64 bit, access_ok in the context of the
> kernel thread will not DTRT.

In which case you need a 'user_access_begin' that takes the mm
as an additional parameter.

I found an 'interesting' acccess_ok() call in the code that copies
iov[] into kernel (eg for readv()).

a) It is a long way from any copies.
b) It can be conditionally ignored - and is so for one call.
   The oddball is code that reads from a different process.
   I didn't spot an equivalent check, but it all worked by
   mapping in the required page - so I'm not sure what happens.

Are there really just 2 limits for access_ok().
One for 64bit programs and one for 32bit?
With the limit being just below the 'dso' page??
So checking the current processes limit is never going
to restrict access.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2020-06-02 20:41 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  8:45 [PATCH RFC] uaccess: user_access_begin_after_access_ok() Michael S. Tsirkin
2020-06-02 10:15 ` Jason Wang
2020-06-02 16:33   ` Al Viro
2020-06-02 17:18     ` Linus Torvalds
2020-06-02 17:44       ` Al Viro
2020-06-02 17:46         ` Al Viro
2020-06-02 20:32       ` Michael S. Tsirkin
2020-06-02 20:41         ` David Laight [this message]
2020-06-02 21:58           ` Al Viro
2020-06-03  8:08             ` David Laight
2020-06-02 20:43         ` Linus Torvalds
2020-06-03  6:01           ` Michael S. Tsirkin
     [not found]             ` <CAHk-=wi3=QuD30fRq8fYYTj9WmkgeZ0VR_Sh3DQHU+nmwj-jMg@mail.gmail.com>
2020-06-03 16:59               ` Linus Torvalds
2020-06-02 16:30 ` Al Viro
2020-06-02 20:42   ` Michael S. Tsirkin
2020-06-02 22:10     ` Al Viro
2020-06-03  5:17       ` Michael S. Tsirkin
2020-06-03  1:48 ` Al Viro
2020-06-03  3:57   ` Jason Wang
2020-06-03  4:18     ` Al Viro
2020-06-03  5:18       ` Jason Wang
2020-06-03  5:46         ` Michael S. Tsirkin
2020-06-03  6:23           ` Jason Wang
2020-06-03  6:30             ` Michael S. Tsirkin
2020-06-03  6:36               ` Jason Wang
2020-06-04 16:49                 ` Michael S. Tsirkin
2020-06-05 10:03                   ` Jason Wang
2020-06-06 20:08                     ` Michael S. Tsirkin
2020-06-03  6:25       ` Michael S. Tsirkin
2020-06-03  5:29   ` Michael S. Tsirkin
2020-06-03 16:52     ` Al Viro
2020-06-04  6:10       ` Jason Wang
2020-06-04 14:59         ` Al Viro
2020-06-04 16:46           ` Michael S. Tsirkin
2020-06-04 10:10       ` Michael S. Tsirkin
2020-06-04 15:03         ` Al Viro
2020-06-04 16:47           ` Michael S. Tsirkin

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=950896ceff2d44e8aaf6f9f5fab210e4@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.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).