Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-100703

Support attaching BPF programs to kernel Rust functions

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Epic Epic
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • kernel / BPF
    • None
    • Low
    • BPF: kernel Rust support
    • rhel-kernel-tracing
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified

      This epic is to track work and tasks necessary on either RHEL or upstream side to support attachment of BPF programs to Rust functions in the kernel.

      At the moment, it is not possible to attach BPF programs to kernel functions written in Rust, using any of the existing attachment mechanisms. This is caused by multiple reasons listed below.

      Missing BTF

      Currently, pahole does not support generating BTF for Rust types and function entries. Similarly, the rest of the BTF tooling assumes that the types recorded in BTF come from C while Rust types have some specifics.

      The lack of BTF forbids usage of BPF trampolines (fentry/fexit probes) and "raw tracepoints" for program attachment. In addition, there's a large amount of BPF features which require BTF to work (e.g. CO-RE).

      Rust functions marked as notrace

      Rust functions are present (in a mangled form) in /proc/kallsyms, however, they are not listed in /sys/kernel/tracing/available_filter_functions and seem to be marked as "notrace". This prevents attaching to them via kprobes, using either ftrace for function entry/exit (as ftrace relies on /sys/kernel/tracing/available_filter_functions) or perf events (attempt to create a kprobe fails with "Could not probe notrace function ...").

              vmalik@redhat.com Viktor Malík
              vmalik@redhat.com Viktor Malík
              Viktor Malík Viktor Malík
              Core Kernel QE Core Kernel QE
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: