Skip to content

Commit a98d6e6

Browse files
authored
[Medium] patch libbpf for CVE-2025-29481 (#13383)
1 parent 4ac6507 commit a98d6e6

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

SPECS/libbpf/CVE-2025-29481.patch

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From cad2b9b3001ecc231444782e77a9bfbd9d8f5d13 Mon Sep 17 00:00:00 2001
2+
From: jykanase <v-jykanase@microsoft.com>
3+
Date: Mon, 14 Apr 2025 08:39:11 +0000
4+
Subject: [PATCH] CVE-2025-29481
5+
6+
Upstream patch reference: https://lore.kernel.org/bpf/20250410073407.131211-1-vmalik@redhat.com/
7+
---
8+
src/libbpf.c | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/src/libbpf.c b/src/libbpf.c
12+
index 2ca30cc..f62a432 100644
13+
--- a/src/libbpf.c
14+
+++ b/src/libbpf.c
15+
@@ -816,7 +816,7 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data,
16+
return -LIBBPF_ERRNO__FORMAT;
17+
}
18+
19+
- if (sec_off + prog_sz > sec_sz) {
20+
+ if (sec_off >= sec_sz || sec_off + prog_sz > sec_sz) {
21+
pr_warn("sec '%s': program at offset %zu crosses section boundary\n",
22+
sec_name, sec_off);
23+
return -LIBBPF_ERRNO__FORMAT;
24+
--
25+
2.45.2
26+

SPECS/libbpf/libbpf.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
Summary: Libbpf library
22
Name: libbpf
33
Version: 1.0.1
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: LGPLv2 OR BSD
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
URL: https://github.com/%{name}/%{name}
99
Source0: https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
10+
Patch0: CVE-2025-29481.patch
1011
BuildRequires: elfutils-devel
1112
BuildRequires: elfutils-libelf-devel
1213
BuildRequires: gcc
@@ -31,7 +32,7 @@ developing applications that use %{name}
3132
%global make_flags DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags} -fPIC" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1
3233

3334
%prep
34-
%autosetup
35+
%autosetup -p1
3536

3637
%build
3738
%make_build -C ./src %{make_flags}
@@ -50,6 +51,9 @@ find %{buildroot} -type f -name "*.a" -delete -print
5051
%{_libdir}/pkgconfig/libbpf.pc
5152

5253
%changelog
54+
* Mon Apr 14 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 1.0.1-2
55+
- Patch for CVE-2025-29481
56+
5357
* Mon Oct 03 2022 Muhammad Falak <mwani@microsoft.com> - 1.0.1-1
5458
- Bump version to 1.0.1
5559

0 commit comments

Comments
 (0)