Arnd Bergmann
12700c17fc
uaccess: generalize access_ok()
...
There are many different ways that access_ok() is defined across
architectures, but in the end, they all just compare against the
user_addr_max() value or they accept anything.
Provide one definition that works for most architectures, checking
against TASK_SIZE_MAX for user processes or skipping the check inside
of uaccess_kernel() sections.
For architectures without CONFIG_SET_FS(), this should be the fastest
check, as it comes down to a single comparison of a pointer against a
compile-time constant, while the architecture specific versions tend to
do something more complex for historic reasons or get something wrong.
Type checking for __user annotations is handled inconsistently across
architectures, but this is easily simplified as well by using an inline
function that takes a 'const void __user *' argument. A handful of
callers need an extra __user annotation for this.
Some architectures had trick to use 33-bit or 65-bit arithmetic on the
addresses to calculate the overflow, however this simpler version uses
fewer registers, which means it can produce better object code in the
end despite needing a second (statically predicted) branch.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Mark Rutland <mark.rutland@arm.com> [arm64, asm-generic]
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Stafford Horne <shorne@gmail.com>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2022-02-25 09:36:05 +01:00
..
2019-06-19 17:09:52 +02:00
2018-03-18 07:38:46 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-04 18:03:39 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-05-26 13:20:52 +02:00
2021-05-26 13:20:52 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-07-21 18:22:02 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2022-01-15 08:47:31 -08:00
2022-01-15 08:47:31 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-21 15:35:43 -08:00
2017-11-02 11:10:55 +01:00
2020-10-25 14:51:49 -07:00
2020-06-08 11:05:57 -07:00
2020-06-08 11:05:57 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-08-20 15:45:21 -04:00
2020-08-20 15:45:21 -04:00
2020-08-20 15:45:21 -04:00
2017-11-02 11:10:55 +01:00
2017-11-15 14:21:03 +09:00
2021-05-26 13:20:52 +02:00
2021-07-07 10:47:21 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-09-08 15:32:35 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-10-14 20:19:31 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-06-05 17:37:16 +02:00
2020-04-02 18:11:55 -07:00
2018-12-11 14:45:29 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-01-03 20:05:18 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-01-03 20:05:18 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-06-09 09:39:13 -07:00
2020-05-12 19:34:53 +03:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-03-23 14:08:18 -04:00
2020-03-27 23:58:52 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-14 11:25:28 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-01-24 10:34:52 -08:00
2020-06-03 20:09:46 -07:00
2017-11-02 11:10:55 +01:00
2018-03-18 07:38:45 -07:00
2020-08-07 11:33:26 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-05 09:44:41 +01:00
2021-05-07 00:26:34 -07:00
2020-06-09 09:39:13 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-09 06:54:27 +02:00
2018-05-09 06:54:27 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-02-10 23:34:16 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-05-02 00:43:34 +09:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-09-30 21:24:06 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-12-28 14:12:21 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-02-18 16:37:42 -08:00
2017-11-02 11:10:55 +01:00
2018-03-18 07:38:48 -07:00
2020-10-27 16:02:38 +01:00
2020-10-27 16:02:38 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-06-29 10:53:55 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-05-13 15:32:00 -07:00
2020-04-10 15:36:21 -07:00
2017-11-02 11:10:55 +01:00
2018-11-18 13:35:21 -08:00
2017-11-02 11:10:55 +01:00
2019-08-08 15:12:07 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-07-10 12:00:01 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-07-01 11:06:03 -07:00
2021-07-01 11:06:03 -07:00
2017-11-02 11:10:55 +01:00
2021-07-08 11:48:22 -07:00
2021-07-08 11:48:22 -07:00
2017-11-02 11:10:55 +01:00
2020-07-21 18:25:59 -07:00
2017-11-02 11:10:55 +01:00
2021-10-15 11:25:14 +02:00
2021-10-15 11:25:14 +02:00
2017-11-02 11:10:55 +01:00
2019-05-30 11:26:32 -07:00
2017-11-02 11:10:55 +01:00
2021-10-06 11:27:41 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2014-05-18 19:01:28 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-09-14 17:04:49 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-08-12 10:57:57 -07:00
2017-11-07 10:32:44 +01:00
2021-02-11 07:59:54 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-03-25 10:19:43 +09:00
2020-03-25 10:19:43 +09:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-10-26 15:04:41 -07:00
2017-11-02 11:10:55 +01:00
2021-09-14 16:06:20 +02:00
2020-06-23 10:49:54 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-12-12 09:17:38 -07:00
2021-01-03 20:10:54 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-08-06 16:13:13 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-04-03 10:32:54 +02:00
2021-01-29 20:02:29 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-17 16:10:04 -08:00
2017-11-02 11:10:55 +01:00
2020-07-10 12:00:01 +02:00
2017-11-02 11:10:55 +01:00
2017-11-17 20:21:44 -08:00
2017-11-02 11:10:55 +01:00
2018-03-18 07:38:45 -07:00
2017-11-02 11:10:55 +01:00
2022-02-25 09:36:05 +01:00
2022-02-25 09:36:05 +01:00
2022-02-25 09:36:05 +01:00
2019-02-07 00:13:28 +01:00
2017-11-02 11:10:55 +01:00
2019-05-21 11:28:45 +02:00
2020-11-06 23:14:57 +01:00
2018-10-25 10:36:19 -07:00
2017-11-02 11:10:55 +01:00
2020-05-13 15:32:00 -07:00
2021-05-14 13:45:58 +02:00
2017-11-02 11:10:55 +01:00
2019-12-10 10:12:55 +01:00
2020-08-06 16:13:13 +02:00
2017-11-02 11:10:55 +01:00
2019-05-24 17:27:13 +02:00
2019-05-24 17:27:13 +02:00
2017-11-02 11:10:55 +01:00