diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-05-05 21:29:57 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-05-05 21:29:57 +0200 |
commit | d5ed10bb80bb376501cb56015a47457647efaabf (patch) | |
tree | 1ad60b31e4271492000805b20efacbe5247d5dbb /mm | |
parent | Merge tag 'riscv-for-linus-6.4-mw2' of git://git.kernel.org/pub/scm/linux/ker... (diff) | |
parent | x86-64: mm: clarify the 'positive addresses' user address rules (diff) | |
download | linux-d5ed10bb80bb376501cb56015a47457647efaabf.tar.xz linux-d5ed10bb80bb376501cb56015a47457647efaabf.zip |
Merge branch 'x86-uaccess-cleanup': x86 uaccess header cleanups
Merge my x86 uaccess updates branch.
The LAM ("Linear Address Masking") updates in this release made me
unhappy about how "access_ok()" was done, and it actually turned out to
have a couple of small bugs in it too. This is my cleanup of the code:
- use the sign bit of the __user pointer rather than masking the
address and checking it against the TASK_SIZE range.
We already did this part for the get/put_user() side, but
'access_ok()' did the naïve "mask and range check" thing, which not
only generates nasty code, but also ended up meaning that __access_ok
itself didn't do a good job, and so copy_from_user_nmi() didn't get
the check right.
- move all the code that is 64-bit only into the 64-bit version of the
header file, so that we don't unnecessarily pollute the shared x86
code and make it look like LAM might work in 32-bit too.
- fix a bug in the address masking (that doesn't end up mattering: in
this case the fix was to just remove the buggy code entirely).
- a couple of trivial cleanups and added commentary about the
access_ok() rules.
* x86-uaccess-cleanup:
x86-64: mm: clarify the 'positive addresses' user address rules
x86: mm: remove 'sign' games from LAM untagged_addr*() macros
x86: uaccess: move 32-bit and 64-bit parts into proper <asm/uaccess_N.h> header
x86: mm: remove architecture-specific 'access_ok()' define
x86-64: make access_ok() independent of LAM
Diffstat (limited to 'mm')
-rw-r--r-- | mm/gup.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2970,6 +2970,8 @@ static int internal_get_user_pages_fast(unsigned long start, len = nr_pages << PAGE_SHIFT; if (check_add_overflow(start, len, &end)) return 0; + if (end > TASK_SIZE_MAX) + return -EFAULT; if (unlikely(!access_ok((void __user *)start, len))) return -EFAULT; |