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

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