Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   bpf-helpers    ( 7 )

список вспомогательных функций eBPF (list of eBPF helper functions)

  Name  |  Description  |  Helpers  |  Examples  |    Implementation    |  See also  |

IMPLEMENTATION

This manual page is an effort to document the existing eBPF helper functions. But as of this writing, the BPF sub-system is under heavy development. New eBPF program or map types are added, along with new helper functions. Some helpers are occasionally made available for additional program types. So in spite of the efforts of the community, this page might not be up-to-date. If you want to check by yourself what helper functions exist in your kernel, or what types of programs they can support, here are some files among the kernel tree that you may be interested in:

include/uapi/linux/bpf.h is the main BPF header. It contains the full list of all helper functions, as well as many other BPF definitions including most of the flags, structs or constants used by the helpers.

net/core/filter.c contains the definition of most network-related helper functions, and the list of program types from which they can be used.

kernel/trace/bpf_trace.c is the equivalent for most tracing program-related helpers.

kernel/bpf/verifier.c contains the functions used to check that valid types of eBPF maps are used with a given helper function.

kernel/bpf/ directory contains other files in which additional helpers are defined (for cgroups, sockmaps, etc.).

• The bpftool utility can be used to probe the availability of helper functions on the system (as well as supported program and map types, and a number of other parameters). To do so, run bpftool feature probe (see bpftool-feature(8) for details). Add the unprivileged keyword to list features available to unprivileged users.

Compatibility between helper functions and program types can generally be found in the files where helper functions are defined. Look for the struct bpf_func_proto objects and for functions returning them: these functions contain a list of helpers that a given program type can call. Note that the default: label of the switch ... case used to filter helpers can call other functions, themselves allowing access to additional helpers. The requirement for GPL license is also in those struct bpf_func_proto.

Compatibility between helper functions and map types can be found in the check_map_func_compatibility() function in file kernel/bpf/verifier.c.

Helper functions that invalidate the checks on data and data_end pointers for network processing are listed in function bpf_helper_changes_pkt_data() in file net/core/filter.c.