Skip to contentSkip to conversation

bcc: Add ARM64 syscall prefix detection in C++ API

PATCH New [email protected] 1 participant 3 messages Mar 8 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 bcc: Add ARM64 syscall prefix detection in C++ API

From: Harish Sadineni <[email protected]>

Fixes issue where bpf.get_syscall_fnname() on ARM64 returns bare syscall name instead of the prefixed _arm64_sys variant, causing kprobe attachment failures. Now detects ARM64 prefix alongside x64 (x64_sys) and generic (sys) prefixes.

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

---
 ...64-syscall-prefix-detection-in-C-API.patch | 35 +++++++++++++++++++
 .../recipes-devtools/bcc/bcc_0.35.0.bb        |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Add-ARM64-syscall-prefix-detection-in-C-API.patch
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Add-ARM64-syscall-prefix-detection-in-C-API.patch new file +35 -0
new file mode 100644
index 0000000000..d6b52438c4
@@ -0,0 +1,35 @@
+From b901fb0088a7605eec00af7b644e25987995d693 Mon Sep 17 00:00:00 2001
+From: Harish Sadineni <[email protected]>
+Date: Sat, 7 Mar 2026 07:18:43 -0800
+Subject: [PATCH] Add ARM64 syscall prefix detection in C++ API
+
+Fixes issue where bpf.get_syscall_fnname() on ARM64 returns bare
+syscall name instead of the prefixed __arm64_sys_ variant, causing
+kprobe attachment failures. Now detects ARM64 prefix alongside x64
+(__x64_sys_) and generic (sys_) prefixes.
+
+Fixes: #5350
+
+Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5489]
+
+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 2a77c2c9..11c6c542 100644
+--- a/src/cc/api/BPF.cc
++++ b/src/cc/api/BPF.cc
+@@ -780,6 +780,8 @@ std::string BPF::get_syscall_fnname(const std::string& name) {
+       syscall_prefix_.reset(new std::string("sys_"));
+     else if (ksym.resolve_name(nullptr, "__x64_sys_bpf", &addr))
+       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
+       syscall_prefix_.reset(new std::string());
+   }
+-- 
+2.49.0
+
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb +1 -0
index 8c6e44edbc..25528e1b10 100644
@@ -22,6 +22,7 @@ SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https;tag=v${PV
            file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \
            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://run-ptest \
            file://ptest_wrapper.sh \
            file://fix_for_memleak.patch \
Signature · 1 line
2.49.0
#1 lore raw

PATCH 2/3 bcc: Add riscv syscall prefix detection in C++ API

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]

---
 ...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
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0002-Add-riscv-syscall-prefix-detection-in-C-API.patch new file +32 -0
new file mode 100644
index 0000000000..78bf1df7c3
@@ -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
+
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb +1 -0
index 25528e1b10..3a34f04349 100644
@@ -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 \
Signature · 1 line
2.49.0
#2 lore raw

PATCH 3/3 bcc: Add ARM and AArch64 support to static tracepoints

In reply to [email protected]

From: Harish Sadineni <[email protected]>

This resolves USDT probe test failures on ARM64 platforms. Without these changes, the .note.stapsdt section containing probe information was missing entirely on ARM64, causing test failures when attempting to find and attach to USDT probes in the BCC test suite.

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

---
 ...move-x86-specific-naming-from-tracin.patch | 25 +++++++
 ...d-ARM-and-AArch64-support-to-static-.patch | 67 +++++++++++++++++++
 .../recipes-devtools/bcc/bcc_0.35.0.bb        |  2 +
 3 files changed, 94 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0003-folly-tracing-Remove-x86-specific-naming-from-tracin.patch
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0004-folly-tracing-Add-ARM-and-AArch64-support-to-static-.patch
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0003-folly-tracing-Remove-x86-specific-naming-from-tracin.patch new file +25 -0
new file mode 100644
index 0000000000..2c1ff2dd73
@@ -0,0 +1,25 @@
+From c2bd977c6c885d5cdca94ef5ac31bfcd9c4347ea Mon Sep 17 00:00:00 2001
+From: Harish Sadineni <[email protected]>
+Date: Sat, 7 Mar 2026 21:44:41 +0000
+Subject: [PATCH 1/2] folly/tracing: Remove x86-specific naming from tracing
+ header
+
+Rename StaticTracepoint-ELFx86.h to StaticTracepoint-ELF.h so the header
+name is no longer tied to a specific architecture, enabling future
+support for additional architectures.
+
+Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5491]
+
+Signed-off-by: Harish Sadineni <[email protected]>
+---
+ .../tracing/{StaticTracepoint-ELFx86.h => StaticTracepoint-ELF.h} | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ rename tests/python/include/folly/tracing/{StaticTracepoint-ELFx86.h => StaticTracepoint-ELF.h} (100%)
+
+diff --git a/tests/python/include/folly/tracing/StaticTracepoint-ELFx86.h b/tests/python/include/folly/tracing/StaticTracepoint-ELF.h
+similarity index 100%
+rename from tests/python/include/folly/tracing/StaticTracepoint-ELFx86.h
+rename to tests/python/include/folly/tracing/StaticTracepoint-ELF.h
+-- 
+2.49.1
+
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0004-folly-tracing-Add-ARM-and-AArch64-support-to-static-.patch new file +67 -0

67 lines not on this page · raw message

meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb +2 -0
index 3a34f04349..4051d7fe11 100644
@@ -24,6 +24,8 @@ SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https;tag=v${PV
            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://0003-folly-tracing-Remove-x86-specific-naming-from-tracin.patch \
+           file://0004-folly-tracing-Add-ARM-and-AArch64-support-to-static-.patch \
            file://run-ptest \
            file://ptest_wrapper.sh \
            file://fix_for_memleak.patch \
Signature · 1 line
2.49.0