mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
libbpf: check map name retrieved from ELF
Validate there was no error retrieving symbol name corresponding to a BPF map. Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
12ef5634a8
commit
c51829bb6e
1 changed files with 5 additions and 0 deletions
|
@ -920,6 +920,11 @@ bpf_object__init_maps(struct bpf_object *obj, int flags)
|
|||
map_name = elf_strptr(obj->efile.elf,
|
||||
obj->efile.strtabidx,
|
||||
sym.st_name);
|
||||
if (!map_name) {
|
||||
pr_warning("failed to get map #%d name sym string for obj %s\n",
|
||||
map_idx, obj->path);
|
||||
return -LIBBPF_ERRNO__FORMAT;
|
||||
}
|
||||
|
||||
obj->maps[map_idx].libbpf_type = LIBBPF_MAP_UNSPEC;
|
||||
obj->maps[map_idx].offset = sym.st_value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue