Skip to content

Commit dc2340b

Browse files
authored
[Medium] patch bcc for CVE-2025-29481 (#13426)
1 parent 05e88db commit dc2340b

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

SPECS/bcc/CVE-2025-29481.patch

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From bdf29d4b10368cb895961356c09262c16f10d4cf Mon Sep 17 00:00:00 2001
2+
From: jykanase <[email protected]>
3+
Date: Mon, 14 Apr 2025 12:42:44 +0000
4+
Subject: [PATCH] CVE
5+
6+
Upstream patch reference: https://lore.kernel.org/bpf/[email protected]/
7+
---
8+
libbpf-tools/bpftool/libbpf/src/libbpf.c | 2 +-
9+
src/cc/libbpf/src/libbpf.c | 2 +-
10+
2 files changed, 2 insertions(+), 2 deletions(-)
11+
12+
diff --git a/libbpf-tools/bpftool/libbpf/src/libbpf.c b/libbpf-tools/bpftool/libbpf/src/libbpf.c
13+
index 3ad1392..4d8da50 100644
14+
--- a/libbpf-tools/bpftool/libbpf/src/libbpf.c
15+
+++ b/libbpf-tools/bpftool/libbpf/src/libbpf.c
16+
@@ -816,7 +816,7 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data,
17+
return -LIBBPF_ERRNO__FORMAT;
18+
}
19+
20+
- if (sec_off + prog_sz > sec_sz) {
21+
+ if (sec_off >= sec_sz || sec_off + prog_sz > sec_sz) {
22+
pr_warn("sec '%s': program at offset %zu crosses section boundary\n",
23+
sec_name, sec_off);
24+
return -LIBBPF_ERRNO__FORMAT;
25+
diff --git a/src/cc/libbpf/src/libbpf.c b/src/cc/libbpf/src/libbpf.c
26+
index 2600d83..40d791a 100644
27+
--- a/src/cc/libbpf/src/libbpf.c
28+
+++ b/src/cc/libbpf/src/libbpf.c
29+
@@ -826,7 +826,7 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data,
30+
return -LIBBPF_ERRNO__FORMAT;
31+
}
32+
33+
- if (sec_off + prog_sz > sec_sz) {
34+
+ if (sec_off >= sec_sz || sec_off + prog_sz > sec_sz) {
35+
pr_warn("sec '%s': program at offset %zu crosses section boundary\n",
36+
sec_name, sec_off);
37+
return -LIBBPF_ERRNO__FORMAT;
38+
--
39+
2.45.2
40+

SPECS/bcc/bcc.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Summary: BPF Compiler Collection (BCC)
33
Name: bcc
44
Version: 0.29.1
5-
Release: 2%{?dist}
5+
Release: 3%{?dist}
66
License: ASL 2.0
77
Vendor: Microsoft Corporation
88
Distribution: Azure Linux
@@ -11,6 +11,7 @@ URL: https://github.com/iovisor/bcc
1111
# Upstream now provides a release with the git submodule embedded in it
1212
Source0: https://github.com/iovisor/bcc/releases/download/v%{version}/%{name}-src-with-submodule.tar.gz#/%{name}-%{version}.tar.gz
1313
Patch0: CVE-2024-2314.patch
14+
Patch1: CVE-2025-29481.patch
1415
BuildRequires: bison
1516
BuildRequires: clang-devel
1617
BuildRequires: cmake >= 2.8.7
@@ -123,6 +124,9 @@ find %{buildroot}%{_lib64dir} -name '*.a' -delete
123124
%{_datadir}/%{name}/man/*
124125

125126
%changelog
127+
* Mon Apr 14 2025 Jyoti Kanase <[email protected]> - 0.29.1-3
128+
- Patch CVE-2025-29481
129+
126130
* Tue Mar 18 2025 Jyoti Kanase <[email protected]> - 0.29.1-2
127131
- Fix CVE-2024-2314
128132

0 commit comments

Comments
 (0)