All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Sterba <dsterba@suse.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Anton Altaparmakov <anton@tuxera.com>,
	David Howells <dhowells@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Pavel Begunkov <asml.silence@gmail.com>
Subject: Re: [PATCH] iov_iter: separate direction from flavour
Date: Mon, 5 Jul 2021 07:17:40 +0200	[thread overview]
Message-ID: <20210705051740.GA543@lst.de> (raw)
In-Reply-To: <CAHk-=wj0Q8R_3AxZO-34Gp2sEQAGUKhw7t6g4QtsnSxJTxb7WA@mail.gmail.com>

On Sun, Jul 04, 2021 at 01:41:51PM -0700, Linus Torvalds wrote:
> On Sun, Jul 4, 2021 at 1:28 PM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > Turns out that, at least on m68k/nommu, USER_DS and KERNEL_DS are the same.
> >
> > #define USER_DS         MAKE_MM_SEG(TASK_SIZE)
> > #define KERNEL_DS       MAKE_MM_SEG(0xFFFFFFFF)
> 
> Ahh. So the code is fine, it's just that "uaccess_kernel()" isn't
> something that can be reliably even tested for, and it will always
> return true on those nommu platforms.

Yes, I think m68knommu and armnommu have this problems.  They really
need to be converted to stop implementing set_fs ASAP, as there is no
point for them.

> And we don't have a "uaccess_user()" macro that would test if it
> matches USER_DS (and that also would always return true on those
> configurations), so we can't just change the
> 
>         WARN_ON_ONCE(uaccess_kernel());
> 
> into a
> 
>         WARN_ON_ONCE(!uaccess_user());
> 
> instead.
> 
> Very annoying. Basically, every single use of "uaccess_kernel()" is unreliable.

Yes.

> The other alternative would be to just make nommu platforms that have
> KERNEL_DS==USER_DS simply do
> 
>     #define uaccess_kernel() (false)
> 
> and avoid it that way, since that's closer to what the modern
> non-CONFIG_SET_FS world view is, and is what include/linux/uaccess.h
> does for that case..

Maybe that is the best short-term bandaid.

      parent reply	other threads:[~2021-07-05  5:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 17:29 [PATCH] iov_iter: separate direction from flavour Guenter Roeck
2021-07-04 18:31 ` Linus Torvalds
2021-07-04 18:54   ` Guenter Roeck
2021-07-04 19:04     ` Linus Torvalds
2021-07-04 20:28       ` Guenter Roeck
2021-07-04 20:41         ` Linus Torvalds
2021-07-04 21:47           ` Guenter Roeck
2021-07-04 22:44             ` Linus Torvalds
2021-07-04 22:47               ` Matthew Wilcox
2021-07-04 22:53                 ` Linus Torvalds
2021-07-04 23:34                   ` Linus Torvalds
2021-07-05  5:17           ` Christoph Hellwig [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=20210705051740.GA543@lst.de \
    --to=hch@lst.de \
    --cc=anton@tuxera.com \
    --cc=asml.silence@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dsterba@suse.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=miklos@szeredi.hu \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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.