Re: [PATCH bpf-next v3] bpftool: Compute map size of light skeletons at runtime

From: Quentin Monnet

Date: Thu Sep 17 2026 - 07:32:33 EST


2026-09-16 00:14 UTC+0800 ~ Leon Hwang <leon.hwang@xxxxxxxxx>
> bpftool rounds memory-mapped data map sizes to the host page size when
> generating a light skeleton. The generated code therefore uses a 64K
> mapping size when bpftool runs on a 64K-page host, even if the skeleton
> runs on a 4K-page target. The target rejects the oversized map mmap(),
> causing failure of loading the light skeleton.
>
> When try to run 64K-page selftests on 4K-page VM, the error message does
> not provide the reason about page size.
>
> test_atomics:PASS:atomics skeleton open 0 nsec
> test_atomics:FAIL:atomics skeleton load unexpected error: -12 (errno 22)
> #15 atomics:FAIL
>
> Pass the original map value size and max entries to the generated code and
> round mmap size to the runtime page size in the user-space light
> skeleton helpers. This keeps generated light skeletons independent of the
> build host page size.
>
> Fixes: d510296d331a ("bpftool: Use syscall/loader program in "prog load" and "gen skeleton" command.")
> Signed-off-by: Leon Hwang <leon.hwang@xxxxxxxxx>


Looks good as far as I can tell, thank you!

Acked-by: Quentin Monnet <qmo@xxxxxxxxxx>