On Thu, Feb 17, 2022 at 10:55 AM sunyucong@xxxxxxxxx <sunyucong@xxxxxxxxx> wrote: > > > Should it be: > > bpf_object__close(obj); > > obj = NULL: > > No, the actual crash is caused by this line: > https://github.com/kernel-patches/bpf/blob/bpf-next/tools/testing/selftests/bpf/prog_tests/core_reloc.c#L896 > > When run_btfgen fails, the obj contains uninitialized data and then > bpf_object__close(obj) crashes. Martin's point is that you have to NULL out obj so that on the next iteration this doesn't crash again. I'll fix it up while applying.