Blame SOURCES/bcc-0.25.0-Fix-get_kprobe_functions.patch

f869ca
From c27899b15bca6188d34c0b87b3389eeda2a90cb5 Mon Sep 17 00:00:00 2001
f869ca
From: Jerome Marchand <jmarchan@redhat.com>
f869ca
Date: Mon, 9 Jan 2023 18:17:20 +0100
f869ca
Subject: [PATCH] Fix get_kprobe_functions
f869ca
f869ca
get_kprobe_functions will not only return a function that matches the
f869ca
regular expression, but also any function that starts with a
f869ca
substrings that matches it. This is obviously not the intended
f869ca
behavior.
f869ca
The issue is easily fixed by replacing re.match by re.fullmatch.
f869ca
---
f869ca
 src/python/bcc/__init__.py | 2 +-
f869ca
 1 file changed, 1 insertion(+), 1 deletion(-)
f869ca
f869ca
diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py
f869ca
index 7175b98e..970ddcc2 100644
f869ca
--- a/src/python/bcc/__init__.py
f869ca
+++ b/src/python/bcc/__init__.py
f869ca
@@ -745,7 +745,7 @@ DEBUG_BTF = 0x20
f869ca
                 # Exclude all gcc 8's extra .cold functions
f869ca
                 elif re.match(b'^.*\.cold(\.\d+)?$', fn):
f869ca
                     continue
f869ca
-                if (t.lower() in [b't', b'w']) and re.match(event_re, fn) \
f869ca
+                if (t.lower() in [b't', b'w']) and re.fullmatch(event_re, fn) \
f869ca
                     and fn not in blacklist:
f869ca
                     fns.append(fn)
f869ca
         return set(fns)     # Some functions may appear more than once
f869ca
-- 
f869ca
2.38.1
f869ca