On Thu, Jan 16, 2025 at 11:15 PM Pu Lehui <pulehui@xxxxxxxxxxxxxxx> wrote: > > > > On 2025/1/17 7:34, Andrii Nakryiko wrote: > > On Wed, Jan 15, 2025 at 2:00 AM Pu Lehui <pulehui@xxxxxxxxxxxxxxx> wrote: > >> > >> From: Pu Lehui <pulehui@xxxxxxxxxx> > >> > >> When redirecting the split BTF to the vmlinux base BTF, we need to mark > >> the distilled base struct/union members of split BTF structs/unions in > >> id_map with BTF_IS_EMBEDDED. This indicates that these types must match > >> both name and size later. So if a needed composite type, which is the > >> member of composite type in the split BTF, has a different size in the > >> base BTF we wish to relocate with, btf__relocate() should error out. > >> > >> Signed-off-by: Pu Lehui <pulehui@xxxxxxxxxx> > >> --- > >> v2: Add test about marking BTF_IS_EMBEDDED. > >> > >> .../selftests/bpf/prog_tests/btf_distill.c | 72 +++++++++++++++++++ > >> 1 file changed, 72 insertions(+) > >> > > > > Nice test, thanks! Applied the series to bpf-next. > > Curious, resilient split BTF is currently supported, shall we deprecate > MODULE_ALLOW_BTF_MISMATCH? I'd first give it a bit more time for distilled BTFs to be used widely in practice to work out all the kinks. > > > > >> diff --git a/tools/testing/selftests/bpf/prog_tests/btf_distill.c b/tools/testing/selftests/bpf/prog_tests/btf_distill.c > >> index b72b966df77b..fb67ae195a73 100644 > >> --- a/tools/testing/selftests/bpf/prog_tests/btf_distill.c > >> +++ b/tools/testing/selftests/bpf/prog_tests/btf_distill.c > >> @@ -601,6 +601,76 @@ static void test_distilled_endianness(void) > >> btf__free(base); > >> } > >> > > > > [...] >