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