Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 522574fd authored by Delyan Kratunov's avatar Delyan Kratunov Committed by Daniel Borkmann
Browse files

bpftool: Explicit errno handling in skeletons

Andrii noticed that since f97b8b9b ("bpftool: Fix a bug in subskeleton
code generation") the subskeleton code allows bpf_object__destroy_subskeleton
to overwrite the errno that subskeleton__open would return with. While this
is not currently an issue, let's make it future-proof.

This patch explicitly tracks err in subskeleton__open and skeleton__create
(i.e. calloc failure is explicitly ENOMEM) and ensures that errno is -err on
the error return path. The skeleton code had to be changed since maps and
progs codegen is shared with subskeletons.

Fixes: f97b8b9b

 ("bpftool: Fix a bug in subskeleton code generation")
Signed-off-by: default avatarDelyan Kratunov <delyank@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/3b6bfbb770c79ae64d8de26c1c1bd9d53a4b85f8.camel@fb.com
parent 77c9387c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment