summaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-11-02 18:58:39 +0000
committerAlexei Starovoitov <ast@kernel.org>2026-11-02 22:47:44 +0000
commit9abe2c42ecab6c86b54838d2d645ca2e10204606 (patch)
treee5a80381f4a905dbf4b6242b906205d7b0d6ae98 /scripts/basic/split-include.c
parent38bce81d4743902bef4bf6914f67d15d337c60b5 (diff)
downloadlinux-9abe2c42ecab6c86b54838d2d645ca2e10204606.tar.gz
linux-9abe2c42ecab6c86b54838d2d645ca2e10204606.zip
libbpf: Fix use-after-free in btf__add_type
For every string btf_rewrite_str() does: off = btf__add_str(p->dst, btf__str_by_offset(p->src, *str_off)); When the string belongs to the base, the pointer goes into the raw data of the base. btf__add_str() looks the string up in the base first, btf__find_str() calls btf_ensure_modifiable() on the base, and that frees the raw data. Then strset__find_str() reads the freed string. Make all the bases of dst modifiable before the pointer is taken. This bug is triggered by the sharing of BTF bases between src and dst, as introduced by the resolve_btfids changes to build inline BTF. Fixes: cf91a7db92c6 ("resolve_btfids: Build separate main and inline BTF objects") Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alan Maguire <almagui@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Alan Maguire <almagui@kernel.org> Link: https://patch.msgid.link/20261102185839.1190122-1-almagui@kernel.org
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions