Blame SOURCES/bcc-0.14.0-Forbid-trampolines-for-archs-other-than-x86_64.patch

6da96d
From 3a8276749b291404ec160c1eb0b51925037161aa Mon Sep 17 00:00:00 2001
6da96d
From: Jiri Olsa <jolsa@kernel.org>
6da96d
Date: Wed, 19 Aug 2020 12:47:48 +0200
6da96d
Subject: [PATCH 3/3] Forbid trampolines for archs other than x86_64
6da96d
6da96d
The trampoline support check in bcc does not work properly,
6da96d
so the feature is detected even on architectures that do not
6da96d
support it - all archs other than x86_64.
6da96d
6da96d
We are checking for bpf_trampoline_link_prog to exist in
6da96d
kernel, which works fine on x86_64 to check if the feature
6da96d
is supported, but it's global function, so it exists also
6da96d
in other archs even when the feature is not supported
6da96d
so it returns True also on other archs.
6da96d
6da96d
Adding explicit x86_64 check to support_kfunc function.
6da96d
6da96d
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
6da96d
---
6da96d
 src/python/bcc/__init__.py | 4 ++++
6da96d
 1 file changed, 4 insertions(+)
6da96d
6da96d
diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py
6da96d
index 5b3ff7b2..60ba6ec5 100644
6da96d
--- a/src/python/bcc/__init__.py
6da96d
+++ b/src/python/bcc/__init__.py
6da96d
@@ -22,6 +22,7 @@ import re
6da96d
 import struct
6da96d
 import errno
6da96d
 import sys
6da96d
+import platform
6da96d
 
6da96d
 from .libbcc import lib, bcc_symbol, bcc_symbol_option, bcc_stacktrace_build_id, _SYM_CB_TYPE
6da96d
 from .table import Table, PerfEventArray
6da96d
@@ -884,6 +885,9 @@ DEBUG_BTF = 0x20
6da96d
 
6da96d
     @staticmethod
6da96d
     def support_kfunc():
6da96d
+        # there's no trampoline support for other than x86_64 arch
6da96d
+        if platform.machine() != 'x86_64':
6da96d
+            return False;
6da96d
         if not lib.bpf_has_kernel_btf():
6da96d
             return False;
6da96d
         # kernel symbol "bpf_trampoline_link_prog" indicates kfunc support
6da96d
-- 
6da96d
2.25.4
6da96d