summaryrefslogtreecommitdiffstats
path: root/tools/bpf/resolve_btfids
diff options
context:
space:
mode:
authorFriedrich Vock <friedrich.vock@gmx.de>2024-05-14 09:09:31 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2024-05-24 17:12:12 +0200
commit44382b3ed6b2787710c8ade06c0e97f5970a47c8 (patch)
treeffd66a523cd4888ffba95883d30df99f22a9fb7d /tools/bpf/resolve_btfids
parent8d00547ea8754afdc4a550af2fb7af2e3ba93cf8 (diff)
downloadlinux-44382b3ed6b2787710c8ade06c0e97f5970a47c8.tar.gz
linux-44382b3ed6b2787710c8ade06c0e97f5970a47c8.tar.bz2
linux-44382b3ed6b2787710c8ade06c0e97f5970a47c8.zip
bpf: Fix potential integer overflow in resolve_btfids
err is a 32-bit integer, but elf_update returns an off_t, which is 64-bit at least on 64-bit platforms. If symbols_patch is called on a binary between 2-4GB in size, the result will be negative when cast to a 32-bit integer, which the code assumes means an error occurred. This can wrongly trigger build failures when building very large kernel images. Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object") Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20240514070931.199694-1-friedrich.vock@gmx.de
Diffstat (limited to 'tools/bpf/resolve_btfids')
-rw-r--r--tools/bpf/resolve_btfids/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index d9520cb826b3..af393c7dee1f 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -728,7 +728,7 @@ static int sets_patch(struct object *obj)
static int symbols_patch(struct object *obj)
{
- int err;
+ off_t err;
if (__symbols_patch(obj, &obj->structs) ||
__symbols_patch(obj, &obj->unions) ||