Blob Blame History Raw
From 0f5849187972a50adf0d9eaa8788c11f9fd926ea Mon Sep 17 00:00:00 2001
From: Yonghong Song <yhs@fb.com>
Date: Thu, 28 Feb 2019 11:18:04 -0800
Subject: [PATCH] fix b.support_raw_tracepoint for 5.0 kernel

Fix issue #2240.

In 5.0, the following commit
  commit a38d1107f937ca95dcf820161ef44ea683d6a0b1
  Author: Matt Mullins <mmullins@fb.com>
  Date:   Wed Dec 12 16:42:37 2018 -0800

      bpf: support raw tracepoints in modules
renamed the function bpf_find_raw_tracepoint() to
bpf_get_raw_tracepoint(). The bcc relies on checking
bpf_find_raw_tracepoint() in /proc/kallsyms to detect
whether raw_tracepoint is supported in kernel or not.

We do not have better mechanism to detect raw_tracepoint
support without additional syscalls. So tentatively,
let us just check bpf_get_raw_tracepoint() ksym as well
for raw_tracepoint support.

Signed-off-by: Yonghong Song <yhs@fb.com>
---
 src/python/bcc/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py
index 01d5604b..69a048f3 100644
--- a/src/python/bcc/__init__.py
+++ b/src/python/bcc/__init__.py
@@ -858,7 +858,8 @@ DEBUG_BTF = 0x20
     @staticmethod
     def support_raw_tracepoint():
         # kernel symbol "bpf_find_raw_tracepoint" indicates raw_tracepint support
-        if BPF.ksymname("bpf_find_raw_tracepoint") != -1:
+        if BPF.ksymname("bpf_find_raw_tracepoint") != -1 or \
+           BPF.ksymname("bpf_get_raw_tracepoint") != -1:
             return True
         return False
 
-- 
2.20.1