* [PATCH] bpf: Fix potential integer overflow in resolve_btfids
@ 2024-05-14 7:09 Friedrich Vock
2024-05-24 15:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Friedrich Vock @ 2024-05-14 7:09 UTC (permalink / raw)
To: bpf; +Cc: Jiri Olsa
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.
Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de>
Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Cc: Jiri Olsa <jolsa@kernel.org>
---
tools/bpf/resolve_btfids/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index d9520cb826b31..af393c7dee1f1 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) ||
--
2.45.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bpf: Fix potential integer overflow in resolve_btfids
2024-05-14 7:09 [PATCH] bpf: Fix potential integer overflow in resolve_btfids Friedrich Vock
@ 2024-05-24 15:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-24 15:20 UTC (permalink / raw)
To: Friedrich Vock; +Cc: bpf, jolsa
Hello:
This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Tue, 14 May 2024 09:09:31 +0200 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- bpf: Fix potential integer overflow in resolve_btfids
https://git.kernel.org/bpf/bpf/c/44382b3ed6b2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-24 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-14 7:09 [PATCH] bpf: Fix potential integer overflow in resolve_btfids Friedrich Vock
2024-05-24 15:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox