Skip to content

Commit 1a7ccf4

Browse files
borkmanngregkh
authored andcommitted
bpf: fix bpf_prog_get_info_by_fd to return 0 func_lens for unpriv
[ Upstream commit 28c2fae ] While dbecd73 ("bpf: get kernel symbol addresses via syscall") zeroed info.nr_jited_ksyms in bpf_prog_get_info_by_fd() for queries from unprivileged users, commit 815581c ("bpf: get JITed image lengths of functions via syscall") forgot about doing so and therefore returns the #elems of the user set up buffer which is incorrect. It also needs to indicate a info.nr_jited_func_lens of zero. Fixes: 815581c ("bpf: get JITed image lengths of functions via syscall") Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Sandipan Das <sandipan@linux.vnet.ibm.com> Cc: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5e4ad7c commit 1a7ccf4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎kernel/bpf/syscall.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
19741974
info.jited_prog_len = 0;
19751975
info.xlated_prog_len = 0;
19761976
info.nr_jited_ksyms = 0;
1977+
info.nr_jited_func_lens = 0;
19771978
goto done;
19781979
}
19791980

0 commit comments

Comments
 (0)