Re: [PATCH bpf-next v7 6/9] selftests/bpf: Add arena ASAN runtime to libarena

bot+bpf-ci
2026-04-12T18:28:47Z

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

> diff --git a/tools/testing/selftests/bpf/libarena/src/asan.bpf.c b/tools/testing/selftests/bpf/libarena/src/asan.bpf.c
> new file mode 100644
> index 000000000000..fff12ff50f26
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/libarena/src/asan.bpf.c

[ ... ]

> +SEC("syscall")
> +__weak __noasan int asan_init(struct asan_init_args *args)
> +{
> + u64 globals_pages = args->arena_globals_pages;
> + u64 all_pages = args->arena_all_pages;
> + u64 shadow_map, shadow_pgoff;
> + u64 shadow_pages;
> +
> + if (asan_inited)
> + return 0;
> +
> + /*
> + * Round up the shadow map size to the nearest page.
> + */
> + shadow_pages = all_pages >> ASAN_SHADOW_SHIFT;
> + if ((all_pages & ((1 << ASAN_SHADOW_SHIFT) - 1)))
> + shadow_pages += 1;
> +
> + /*
> + * Make sure the numbers provided by userspace are sane.
> + */

Alexei Starovoitov flagged this comment as unhelpful in v4 review.
The validation checks below with their error messages are
self-documenting. Was the intent to remove this comment or
replace it with something more descriptive?

https://lore.kernel.org/bpf/CAADnVQLHFZE3AFzP3gtZKvcaX+3hbp3pCw3JLqEtpdoQ+OUf7g@mail.gmail.com/

> + if (all_pages > (1ULL << 32) / __PAGE_SIZE) {
> + arena_stderr("error: arena size %lx too large", all_pages);
> + return -EINVAL;
> + }

[ ... ]

---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/24313021445