Files
integ/base/libbpf/debian/trixie/patches/0002-libbpf-Fix-null-pointer-dereference-in-find_prog_by_.patch
Abhinav Ayyapasetti f5b3cfd78f Add libbpf for trixie and bullseye
Aligned the package layout with the concurrent Debian packaging
conventions. Added package files under debian/bullseye and debian/trixie.

This change brings updates from the 'f/trixie' branch into 'master' to
ensure consistent functionality and packaging structure across both
branches.

Test Plan:
PASS  master trixie build
PASS  master bullseye build

Story: 2011360
Task: 53329

Change-Id: I3c3494720dbf1f9a234864a4aff9195595715f75
Signed-off-by: Abhinav Ayyapasetti <ayyapasetti.abhinav@windriver.com>
2025-12-02 05:13:39 -05:00

38 lines
1.4 KiB
Diff

From e13c23b7db2d12cf4adf138f992eeca7f9488bee Mon Sep 17 00:00:00 2001
From: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Date: Wed, 12 Oct 2022 10:23:53 +0800
Subject: [PATCH 2/2] libbpf: Fix null-pointer dereference in
find_prog_by_sec_insn()
When there are no program sections, obj->programs is left unallocated,
and find_prog_by_sec_insn()'s search lands on &obj->programs[0] == NULL,
and will cause null-pointer dereference in the following access to
prog->sec_idx.
Guard the search with obj->nr_programs similar to what's being done in
__bpf_program__iter() to prevent null-pointer access from happening.
Fixes: db2b8b06423c ("libbpf: Support CO-RE relocations for multi-prog sections")
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221012022353.7350-4-shung-hsi.yu@suse.com
Signed-off-by: Iulian Mocanu <iulian.mocanu@windriver.com>
---
src/libbpf.c | 3 +++
1 file changed, 3 insertions(+)
Index: libbpf-0.4.0/src/libbpf.c
===================================================================
--- libbpf-0.4.0.orig/src/libbpf.c
+++ libbpf-0.4.0/src/libbpf.c
@@ -3724,6 +3724,9 @@ static struct bpf_program *find_prog_by_
int l = 0, r = obj->nr_programs - 1, m;
struct bpf_program *prog;
+ if (!obj->nr_programs)
+ return NULL;
+
while (l < r) {
m = l + (r - l + 1) / 2;
prog = &obj->programs[m];