From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnd Bergmann' <arnd@kernel.org>, Michal Simek <monstr@monstr.eu>
Cc: Christoph Hellwig <hch@infradead.org>,
Arnd Bergmann <arnd@arndb.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] microblaze: remove CONFIG_SET_FS
Date: Thu, 10 Feb 2022 09:36:41 +0000 [thread overview]
Message-ID: <80c6df0717014472aa81093ae3894d39@AcuMS.aculab.com> (raw)
In-Reply-To: <20220209144910.1484686-1-arnd@kernel.org>
From: Arnd
> Sent: 09 February 2022 14:49
>
> Remove the address space override API set_fs(). The microblaze user
> address space is now limited to TASK_SIZE.
>
> To support this we implement and wire in __get_kernel_nofault and
> __set_kernel_nofault.
>
> The function user_addr_max is removed as there is a default definition
> provided when CONFIG_SET_FS is not used.
...
> static inline int access_ok(const void __user *addr, unsigned long size)
> {
> if (!size)
> goto ok;
>
> - if ((get_fs().seg < ((unsigned long)addr)) ||
> - (get_fs().seg < ((unsigned long)addr + size - 1))) {
> - pr_devel("ACCESS fail at 0x%08x (size 0x%x), seg 0x%08x\n",
> - (__force u32)addr, (u32)size,
> - (u32)get_fs().seg);
> + if ((((unsigned long)addr) > TASK_SIZE) ||
> + (((unsigned long)addr + size - 1) > TASK_SIZE)) {
> + pr_devel("ACCESS fail at 0x%08x (size 0x%x)",
> + (__force u32)addr, (u32)size);
> return 0;
Isn't that the wrong check?
If 'size' is big 'addr + size' can wrap.
It needs to be (addr >= TASK_SIZE || size > TASK_SIZE - addr)
Which is pretty much a generic version.
Although typical 64bit architectures can use the faster:
((addr | size) >> 62)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-02-10 9:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 14:48 Arnd Bergmann
2022-02-10 9:36 ` David Laight [this message]
2022-02-10 13:29 ` Arnd Bergmann
2022-02-10 14:21 ` David Laight
2022-02-10 14:53 ` Arnd Bergmann
2022-02-10 22:23 ` Stafford Horne
-- strict thread matches above, loose matches on Subject: below --
2022-01-17 13:24 [PATCH 03/10] exit: Move oops specific logic from do_exit into make_task_dead Arnd Bergmann
2022-01-17 13:27 ` [PATCH] microblaze: remove CONFIG_SET_FS Arnd Bergmann
2022-02-09 13:50 ` Michal Simek
2022-02-09 13:52 ` Christoph Hellwig
2022-02-09 14:03 ` Michal Simek
2022-02-09 14:40 ` Arnd Bergmann
2022-02-09 14:44 ` Michal Simek
2022-02-09 14:54 ` Arnd Bergmann
2022-02-09 23:31 ` Stafford Horne
2022-02-11 0:17 ` Stafford Horne
2022-02-11 16:59 ` Arnd Bergmann
2022-02-11 17:46 ` Linus Torvalds
2022-02-11 20:57 ` Arnd Bergmann
2022-02-11 21:10 ` Eric W. Biederman
2022-02-11 22:21 ` Stafford Horne
2022-02-14 7:41 ` Christoph Hellwig
2022-02-14 7:50 ` Christoph Hellwig
2022-02-14 16:20 ` Arnd Bergmann
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=80c6df0717014472aa81093ae3894d39@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=monstr@monstr.eu \
/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
Powered by JetHome