Skip to content

Commit 44382b3

Browse files
pixelclusterborkmann
authored andcommitted
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: fbbb68d ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object") Signed-off-by: Friedrich Vock <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 8d00547 commit 44382b3

File tree

1 file changed

+1
-1
lines changed
  • tools/bpf/resolve_btfids

1 file changed

+1
-1
lines changed

tools/bpf/resolve_btfids/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ static int sets_patch(struct object *obj)
728728

729729
static int symbols_patch(struct object *obj)
730730
{
731-
int err;
731+
off_t err;
732732

733733
if (__symbols_patch(obj, &obj->structs) ||
734734
__symbols_patch(obj, &obj->unions) ||

0 commit comments

Comments
 (0)