tests: fix prog_info initialization in bpf-obj_get_info_by_fd-prog*
The sys_bpf(BPF_OBJ_GET_INFO_BY_FD, &bpf_prog_get_info_attr, ...) is called in a loop. The bpf_prog_get_info_attr.info object is in size 104 but bpf_prog_get_info_attr.info_len is in size 168. Hence, if the prog is jited, the second iteration onwards will have nr_jited_ksyms == 1 which is asking the kernel to fill the bpf_prog_get_info_attr.info.jited_ksyms and it is NULL. * tests/bpf-obj_get_info_by_fd.c (main): Clear memory beyond prog_info at the start of every iteration. Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
parent
3e93457d5f
commit
91cdd32f65
@ -345,6 +345,7 @@ main(void)
|
||||
memset(prog_info, 0, PROG_INFO_SZ);
|
||||
for (unsigned int i = 0; i < 4; i++) {
|
||||
prog_info->jited_prog_len = 0;
|
||||
memset(prog_info + 1, 0, PROG_INFO_SZ - sizeof(*prog_info));
|
||||
switch (i) {
|
||||
case 1:
|
||||
prog_info->xlated_prog_insns =
|
||||
|
Loading…
Reference in New Issue
Block a user