summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorSarthak Sharma <sarthak.sharma@arm.com>2026-09-15 15:55:24 +0530
committerAndrew Morton <akpm@linux-foundation.org>2026-09-29 23:13:31 -0700
commit3c0500d983a7a91d1077711160707b0b3d53ccf8 (patch)
tree025b85a08a620bc288e7f76a8fb9fad0b96fa7d8 /scripts/Makefile.thinlto
parentbfe990ef011ac0089fd4528089fcf1e839c28af8 (diff)
downloadlinux-next-3c0500d983a7a91d1077711160707b0b3d53ccf8.tar.gz
linux-next-3c0500d983a7a91d1077711160707b0b3d53ccf8.zip
mm/gup_test: safely calculate GUP batch size
__gup_test_ioctl() calculates the end of a GUP batch using: next = addr + nr * PAGE_SIZE; If nr is too large, it can cause next to overflow and wrap around. If it wraps, the next > end check is bypassed and a large value of nr is passed to the GUP call, even though the pages array was allocated according to gup->size. This can lead to out of bounds writes. Also, when fewer than PAGE_SIZE bytes remain, the calculated batch contains zero pages. The code still calls GUP functions with pages + i, which can point past the allocated array. Calculate nr by taking the minimum of the number of pages per call and the pages remaining in the address range. Reject zero sized and non page aligned gup->size values and zero nr_pages_per_call value. Link: https://lore.kernel.org/20260915102524.125758-1-sarthak.sharma@arm.com Fixes: 64c349f4ae78 ("mm: add infrastructure for get_user_pages_fast() benchmarking") Signed-off-by: Sarthak Sharma <sarthak.sharma@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions