]> granicus.if.org Git - strace/commit
tests: fix prog_info initialization in bpf-obj_get_info_by_fd-prog*
authorMartin Lau <kafai@fb.com>
Thu, 3 Jan 2019 23:36:22 +0000 (23:36 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 5 Jan 2019 21:14:42 +0000 (21:14 +0000)
commit91cdd32f65b2bea7df9cd6b9bad04d8d08068bb8
treebccf17058fcc9603b073b29917b4f4811a3d2ab1
parent3e93457d5f21cdc02f18293de0c2203481ce70b0
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>
tests/bpf-obj_get_info_by_fd.c