summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc/CVE-2024-2314.patch72
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb1
2 files changed, 73 insertions, 0 deletions
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/CVE-2024-2314.patch b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/CVE-2024-2314.patch
new file mode 100644
index 0000000..100d7e3
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/CVE-2024-2314.patch
@@ -0,0 +1,72 @@
1From 008ea09e891194c072f2a9305a3c872a241dc342 Mon Sep 17 00:00:00 2001
2From: Brendan Gregg <brendan@intel.com>
3Date: Thu, 7 Mar 2024 05:27:14 +1100
4Subject: [PATCH] clang: check header ownership (#4928)
5
6Example testing with a brendan-owned /tmp/kheaders file (note the "ERROR:" message):
7
8~/bcc/build$ sudo /usr/share/bcc/tools/biosnoop
9ERROR: header file ownership unexpected: /tmp/kheaders-5.15.47-internal
10<built-in>:1:10: fatal error: './include/linux/kconfig.h' file not found
11 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
121 error generated.
13Traceback (most recent call last):
14 File "/usr/share/bcc/tools/biosnoop", line 335, in <module>
15 b = BPF(text=bpf_text)
16 File "/usr/lib/python3/dist-packages/bcc-0.1.5+6cd27218-py3.10.egg/bcc/__init__.py", line 479, in __init__
17Exception: Failed to compile BPF module <text>
18~/bcc/build$ ls -lhd /tmp/kheaders-5.15.47-internal
19drwxrwxr-x 2 brendan dev 4.0K Mar 6 02:50 /tmp/kheaders-5.15.47-internal
20
21No error when chown'd back to root.
22
23CVE: CVE-2024-2314
24
25Upstream-Status: Backport [https://github.com/iovisor/bcc/commit/008ea09e891194c072f2a9305a3c872a241dc342]
26
27Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
28---
29 src/cc/frontends/clang/kbuild_helper.cc | 15 +++++++++++----
30 1 file changed, 11 insertions(+), 4 deletions(-)
31
32diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
33index 50e2da9a..d4b9d3e6 100644
34--- a/src/cc/frontends/clang/kbuild_helper.cc
35+++ b/src/cc/frontends/clang/kbuild_helper.cc
36@@ -140,15 +140,22 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
37 return 0;
38 }
39
40-static inline int file_exists(const char *f)
41+static inline int file_exists_and_ownedby(const char *f, uid_t uid)
42 {
43 struct stat buffer;
44- return (stat(f, &buffer) == 0);
45+ int ret;
46+ if ((ret = stat(f, &buffer)) == 0) {
47+ if (buffer.st_uid != uid) {
48+ std::cout << "ERROR: header file ownership unexpected: " << std::string(f) << "\n";
49+ return -1;
50+ }
51+ }
52+ return ret;
53 }
54
55 static inline int proc_kheaders_exists(void)
56 {
57- return file_exists(PROC_KHEADERS_PATH);
58+ return file_exists_and_ownedby(PROC_KHEADERS_PATH, 0);
59 }
60
61 static inline const char *get_tmp_dir() {
62@@ -224,7 +231,7 @@ int get_proc_kheaders(std::string &dirpath)
63 uname_data.release);
64 dirpath = std::string(dirpath_tmp);
65
66- if (file_exists(dirpath_tmp))
67+ if (file_exists_and_ownedby(dirpath_tmp, 0))
68 return 0;
69
70 // First time so extract it
71--
722.40.0
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb
index ec3811e..5e912ad 100644
--- a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb
@@ -25,6 +25,7 @@ SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \
25 file://0001-CMakeLists.txt-don-t-modify-.gitconfig-on-build-host.patch \ 25 file://0001-CMakeLists.txt-don-t-modify-.gitconfig-on-build-host.patch \
26 file://run-ptest \ 26 file://run-ptest \
27 file://ptest_wrapper.sh \ 27 file://ptest_wrapper.sh \
28 file://CVE-2024-2314.patch \
28 " 29 "
29 30
30SRCREV = "eb8ede2d70b17350757f2570ef76ea4c2e1dbff8" 31SRCREV = "eb8ede2d70b17350757f2570ef76ea4c2e1dbff8"