From: Guenter Roeck <firstname.lastname@example.org> To: Linus Torvalds <email@example.com> Cc: Christoph Hellwig <firstname.lastname@example.org>, Al Viro <email@example.com>, linux-fsdevel <firstname.lastname@example.org>, Linux Kernel Mailing List <email@example.com>, David Sterba <firstname.lastname@example.org>, Miklos Szeredi <email@example.com>, Anton Altaparmakov <firstname.lastname@example.org>, David Howells <email@example.com>, Matthew Wilcox <firstname.lastname@example.org>, Pavel Begunkov <email@example.com> Subject: Re: [PATCH] iov_iter: separate direction from flavour Date: Sun, 4 Jul 2021 14:47:24 -0700 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <CAHk-=wj0Q8R_3AxZO-34Gp2sEQAGUKhw7t6g4QtsnSxJTxb7WA@mail.gmail.com> On 7/4/21 1:41 PM, Linus Torvalds wrote: > On Sun, Jul 4, 2021 at 1:28 PM Guenter Roeck <email@example.com> 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. > > 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. > > There aren't all that many of them, and most of them are irrelevant > for no-mmu anyway (like the bpf tracing ones, or mm/memory.c). So this > iov_iter.c case is likely the only one that would be an issue. > > That warning is something that should go away eventually anyway, but I > _like_ that warning for now, just to get coverage. But apparently it's > just not going to be the case for these situations. > > My inclination is to keep it around for a while - to see if it catches > anything else - but remove it for the final 5.14 release because of > these nommu issues. > > Of course, I will almost certainly not remember to do that unless > somebody reminds me... > > 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.. > Theoretically, but arm defines it as true with !CONFIG_MMU and then uses it in user_addr_max(): #define user_addr_max() \ (uaccess_kernel() ? ~0UL : get_fs()) with !CONFIG_MMU: #define KERNEL_DS 0x00000000 #define get_fs() (KERNEL_DS) How about the following ? WARN_ON_ONCE(IS_ENABLED(CONFIG_MMU) && uaccess_kernel()); Guenter
next prev parent reply other threads:[~2021-07-04 21:47 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-04 17:29 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 [this message] 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
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 \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH] iov_iter: separate direction from flavour' \ /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
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).