From: Harish Sadineni <[email protected]>

Fixes issue where bpf.get_syscall_fnname() on riscv64 returns bare syscall
name instead of the prefixed _riscv_sys variant, causing kprobe
attachment failures.

Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5490]

Signed-off-by: Harish Sadineni <[email protected]>
---
 ...cv-syscall-prefix-detection-in-C-API.patch | 32 +++++++++++++++++++
 .../recipes-devtools/bcc/bcc_0.35.0.bb        |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0002-Add-riscv-syscall-prefix-detection-in-C-API.patch

diff --git 
a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0002-Add-riscv-syscall-prefix-detection-in-C-API.patch
 
b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0002-Add-riscv-syscall-prefix-detection-in-C-API.patch
new file mode 100644
index 0000000000..78bf1df7c3
--- /dev/null
+++ 
b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0002-Add-riscv-syscall-prefix-detection-in-C-API.patch
@@ -0,0 +1,32 @@
+From da01655f0f335584867b3427005b95384499a020 Mon Sep 17 00:00:00 2001
+From: Harish Sadineni <[email protected]>
+Date: Sat, 7 Mar 2026 20:20:04 -0800
+Subject: [PATCH 2/2] Add riscv syscall prefix detection in C++ API
+
+Fixes issue where bpf.get_syscall_fnname() on riscv64 returns bare syscall
+name instead of the prefixed _riscv_sys variant, causing kprobe
+attachment failures.
+
+Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5490]
+
+Signed-off-by: Harish Sadineni <[email protected]>
+---
+ src/cc/api/BPF.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/cc/api/BPF.cc b/src/cc/api/BPF.cc
+index 11c6c542..e1df8208 100644
+--- a/src/cc/api/BPF.cc
++++ b/src/cc/api/BPF.cc
+@@ -782,6 +782,8 @@ std::string BPF::get_syscall_fnname(const std::string& 
name) {
+       syscall_prefix_.reset(new std::string("__x64_sys_"));
+     else if (ksym.resolve_name(nullptr, "__arm64_sys_bpf", &addr))
+       syscall_prefix_.reset(new std::string("__arm64_sys_"));
++    else if (ksym.resolve_name(nullptr, "__riscv_sys_bpf", &addr))
++      syscall_prefix_.reset(new std::string("__riscv_sys_"));
+     else
+       syscall_prefix_.reset(new std::string());
+   }
+-- 
+2.49.0
+
diff --git 
a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb 
b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb
index 25528e1b10..3a34f04349 100644
--- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb
+++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb
@@ -23,6 +23,7 @@ SRC_URI = 
"gitsm://github.com/iovisor/bcc;branch=master;protocol=https;tag=v${PV
            
file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \
            file://0001-Fix-a-build-failure-with-clang21-5369.patch \
            file://0001-Add-ARM64-syscall-prefix-detection-in-C-API.patch \
+           file://0002-Add-riscv-syscall-prefix-detection-in-C-API.patch \
            file://run-ptest \
            file://ptest_wrapper.sh \
            file://fix_for_memleak.patch \
-- 
2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#124936): 
https://lists.openembedded.org/g/openembedded-devel/message/124936
Mute This Topic: https://lists.openembedded.org/mt/118200296/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to