Skip to content

Commit

Permalink
Fix get_kprobe_functions
Browse files Browse the repository at this point in the history
get_kprobe_functions will not only return a function that matches the
regular expression, but also any function that starts with a
substrings that matches it. This is obviously not the intended
behavior.
The issue is easily fixed by replacing re.match by re.fullmatch.
  • Loading branch information
jeromemarchand authored and chenhengqi committed Jan 10, 2023
1 parent 77c59c3 commit 2b203ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def get_kprobe_functions(event_re):
# Exclude all gcc 8's extra .cold functions
elif re.match(b'^.*\.cold(\.\d+)?$', fn):
continue
if (t.lower() in [b't', b'w']) and re.match(event_re, fn) \
if (t.lower() in [b't', b'w']) and re.fullmatch(event_re, fn) \
and fn not in blacklist:
fns.append(fn)
return set(fns) # Some functions may appear more than once
Expand Down

0 comments on commit 2b203ea

Please sign in to comment.