On Thu, Dec 10, 2020 at 5:59 PM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > bpf_testmod.ko build rule declared dependency on VMLINUX_BTF, but the variable > itself was initialized after the rule was declared, which often caused > bpf_testmod.ko to not be re-compiled. Fix by moving VMLINUX_BTF determination > sooner. > > Also enforce bpf_testmod.ko recompilation when we detect that vmlinux image > changed by removing bpf_testmod/bpf_testmod.ko. This is necessary to generate > correct module's split BTF. Without it, Kbuild's module build logic might > determine that nothing changed on the kernel side and thus bpf_testmod.ko > shouldn't be rebuilt, so won't re-generate module BTF, which often leads to > module's BTF with wrong string offsets against vmlinux BTF. Removing .ko file > forces Kbuild to re-build the module. > > Reported-by: Alexei Starovoitov <ast@xxxxxxxxxx> > Fixes: 9f7fa225894c ("selftests/bpf: Add bpf_testmod kernel module for testing") > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> Applied. Thanks