summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-02 06:42:31 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 16:22:43 +0000
commitc08b50dd174a1dadb67f215239664c9096a5c4bd (patch)
tree76b27ddd421dbb9e1bcee174c24871ab0d02ec99 /scripts/basic/split-include.c
parent92b5ce3ca5b7c641e2678f92419aa7833951bc9d (diff)
downloadlinux-c08b50dd174a1dadb67f215239664c9096a5c4bd.tar.gz
linux-c08b50dd174a1dadb67f215239664c9096a5c4bd.zip
selftests/bpf: Run arena_mmap serially and test MAP_FIXED addresses
Each arena reserves 4 GiB of vmalloc space. The KASAN shadow of arenas from parallel tests can exhaust the memory of a CI VM. Thus commit a14f9ba080c1 ("selftests/bpf: Run arena tests serially") made arena_* and libarena* serial. Do the same for arena_mmap, which the commit below added later. Add four subtests for "bpf: Don't move a MAP_FIXED address in arena_get_unmapped_area()". Test that mmap() with MAP_FIXED or MAP_FIXED_NOREPLACE fails with EINVAL if the range crosses a 4 GiB boundary. Test that mmap() with MAP_FIXED also fails for a range that wraps and for a map_extra range that ends above TASK_SIZE. Today arena_map_alloc() accepts such a map_extra. map_extra_last_pages also passes if the kernel refuses the map, because no task can map this range. The arch code gets a range before the arena code tests it for a crossing. For the last two ranges LoongArch returns -EINVAL, and powerpc with the hash MMU returns -ENOMEM. There the two subtests do not reach that test. On the other architectures with arenas, the arena code returns -EINVAL or __get_unmapped_area() returns -ENOMEM. Thus the two subtests accept both errnos. All these errors occur before mmap() changes a mapping. Two other changes of that patch have no subtest. With MAP_FIXED the arch code gets len and not 2 * len. A 64-bit task on x86, arm64 or riscv does not see this. LoongArch, s390 and powerpc with the hash MMU compare the end of the range with different limits. In arena_mmap the unsigned ret changes only the errno of map_extra_last_pages, which accepts both. Fixes: 14d3e5bf9ffe ("selftests/bpf: Test the length and the address of an arena mmap()") Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261102064231.2153879-3-alexei.starovoitov@gmail.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions