Search code examples
ebpf

ebpf: about the kfuncs call and MAX_BPF_STACK


  1. Are the stack frames consumed by kfuncs calls still subject to the MAX_BPF_STACK limit?
  2. Is kfuncs a general way to extend the functionality of ebpf programs?

Solution

    1. No, only BPF-to-BPF functions and Tailcalls count towards the stack limit, helper functions and kfuncs do not count towards the limit.

    2. kfuncs are the new helper functions. A decision was made to no longer add helper functions, so new functionality will be added as kfuncs. Note that kfuncs have less stability guarantees with regards to helper functions.

      One thing that helpers do not have is that kfuncs can be added via kernel modules including custom ones. While initially intended for modules part of the kernel, you can technically add custom kfuncs with your own modules. But doing so does reduce the usefulness of eBPF which is meant to be used instead of kernel modules.