Skip to content

Commit 4288b22

Browse files
alan-maguireKernel Patches Daemon
authored andcommitted
libbpf: Fix parsing of multi-split BTF
When creating multi-split BTF we correctly set the start string offset to be the size of the base string section plus the base BTF start string offset; the latter is needed for multi-split BTF since the offset is non-zero there. Unfortunately the BTF parsing case needed that logic and it was missed. Fixes: 4e29128 ("libbpf/btf: Fix string handling to support multi-split BTF") Signed-off-by: Alan Maguire <[email protected]>
1 parent 0ff1d70 commit 4288b22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/lib/bpf/btf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ static struct btf *btf_new(const void *data, __u32 size, struct btf *base_btf, b
10611061
if (base_btf) {
10621062
btf->base_btf = base_btf;
10631063
btf->start_id = btf__type_cnt(base_btf);
1064-
btf->start_str_off = base_btf->hdr->str_len;
1064+
btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off;
10651065
}
10661066

10671067
if (is_mmap) {
@@ -5818,7 +5818,7 @@ void btf_set_base_btf(struct btf *btf, const struct btf *base_btf)
58185818
{
58195819
btf->base_btf = (struct btf *)base_btf;
58205820
btf->start_id = btf__type_cnt(base_btf);
5821-
btf->start_str_off = base_btf->hdr->str_len;
5821+
btf->start_str_off = base_btf->hdr->str_len + base_btf->start_str_off;
58225822
}
58235823

58245824
int btf__relocate(struct btf *btf, const struct btf *base_btf)

0 commit comments

Comments
 (0)