Skip to content

Conversation

@lorenzph
Copy link

The /sys/kernel/debug/tracing mountpoint is considered deprecated and
is only enabled when the CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED kernel
option is set. Some distributions, such as ArchLinux, no longer set
this, which breaks the use of get_kprobe_functions:

Traceback (most recent call last):
  File "biosnoop.py", line 349, in <module>
    if BPF.get_kprobe_functions(b'blk_start_request'):
       ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/bcc/__init__.py", line 735, in get_kprobe_functions
    raise e
  File "/usr/lib/python3.13/site-packages/bcc/__init__.py", line 731, in get_kprobe_functions
    with open(avail_filter_file, "rb") as avail_filter_f:
         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/sys/kernel/debug/tracing/available_filter_functions'

Fix this by using the TRACEFS constant (which is set to the correct
tracefs mountpoint) instead.

The /sys/kernel/debug/tracing mountpoint is considered deprecated and
is only enabled when the CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED kernel
option is set. Some distributions, such as ArchLinux, no longer set
this, which breaks the use of `get_kprobe_functions`:

    Traceback (most recent call last):
      File "biosnoop.py", line 349, in <module>
        if BPF.get_kprobe_functions(b'blk_start_request'):
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.13/site-packages/bcc/__init__.py", line 735, in get_kprobe_functions
        raise e
      File "/usr/lib/python3.13/site-packages/bcc/__init__.py", line 731, in get_kprobe_functions
        with open(avail_filter_file, "rb") as avail_filter_f:
             ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
    FileNotFoundError: [Errno 2] No such file or directory: '/sys/kernel/debug/tracing/available_filter_functions'

Fix this by using the TRACEFS constant (which is set to the correct
tracefs mountpoint) instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant