diff options
author | Kumar Kartikeya Dwivedi <[email protected]> | 2021-09-27 20:29:39 +0530 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2021-09-29 20:42:32 -0700 |
commit | e68ac0082787f4e8ee6ae5b19076ec7709ce715b (patch) | |
tree | e2845cb8473234b3662ddd29058058edc251a7bf /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 161ecd537948a7003129889b04a3a0858687bc70 (diff) |
libbpf: Fix skel_internal.h to set errno on loader retval < 0
When the loader indicates an internal error (result of a checked bpf
system call), it returns the result in attr.test.retval. However, tests
that rely on ASSERT_OK_PTR on NULL (returned from light skeleton) may
miss that NULL denotes an error if errno is set to 0. This would result
in skel pointer being NULL, while ASSERT_OK_PTR returning 1, leading to
a SEGV on dereference of skel, because libbpf_get_error relies on the
assumption that errno is always set in case of error for ptr == NULL.
In particular, this was observed for the ksyms_module test. When
executed using `./test_progs -t ksyms`, prior tests manipulated errno
and the test didn't crash when it failed at ksyms_module load, while
using `./test_progs -t ksyms_module` crashed due to errno being
untouched.
Fixes: 67234743736a (libbpf: Generate loader program out of BPF ELF file.)
Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions