Message ID | 20220404005320.1723055-1-ytcoode@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | a6a86da847eb21f0d93e916194bb59ac5e753318 |
Delegated to: | BPF |
Headers | show |
Series | [bpf-next,v3] libbpf: Don't return -EINVAL if hdr_len < offsetofend(core_relo_len) | expand |
Context | Check | Description |
---|---|---|
bpf/vmtest-bpf-next-PR | pending | PR summary |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Single patches do not need cover letters |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 10 of 10 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | warning | WARNING: line length of 86 exceeds 80 columns |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
Hello: This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <andrii@kernel.org>: On Mon, 4 Apr 2022 08:53:20 +0800 you wrote: > Since core relos is an optional part of the .BTF.ext ELF section, we should > skip parsing it instead of returning -EINVAL if header size is less than > offsetofend(struct btf_ext_header, core_relo_len). > > Signed-off-by: Yuntao Wang <ytcoode@gmail.com> > --- > v1 -> v2: skip core relos if hdr_len < offsetofend(core_relo_len) > v2 -> v3: fix comment style > > [...] Here is the summary with links: - [bpf-next,v3] libbpf: Don't return -EINVAL if hdr_len < offsetofend(core_relo_len) https://git.kernel.org/bpf/bpf-next/c/a6a86da847eb You are awesome, thank you!
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index 1383e26c5d1f..d124e9e533f0 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -2826,10 +2826,8 @@ struct btf_ext *btf_ext__new(const __u8 *data, __u32 size) if (err) goto done; - if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len)) { - err = -EINVAL; - goto done; - } + if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len)) + goto done; /* skip core relos parsing */ err = btf_ext_setup_core_relos(btf_ext); if (err)
Since core relos is an optional part of the .BTF.ext ELF section, we should skip parsing it instead of returning -EINVAL if header size is less than offsetofend(struct btf_ext_header, core_relo_len). Signed-off-by: Yuntao Wang <ytcoode@gmail.com> --- v1 -> v2: skip core relos if hdr_len < offsetofend(core_relo_len) v2 -> v3: fix comment style tools/lib/bpf/btf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)