linux/tools/bpf/bpftool
Quentin Monnet 2d3ea5e85d tools: bpftool: add probes for eBPF helper functions
Similarly to what was done for program types and map types, add a set of
probes to test the availability of the different eBPF helper functions
on the current system.

For each known program type, all known helpers are tested, in order to
establish a compatibility matrix. Output is provided as a set of lists
of available helpers, one per program type.

Sample output:

    # bpftool feature probe kernel
    ...
    Scanning eBPF helper functions...
    eBPF helpers supported for program type socket_filter:
            - bpf_map_lookup_elem
            - bpf_map_update_elem
            - bpf_map_delete_elem
    ...
    eBPF helpers supported for program type kprobe:
            - bpf_map_lookup_elem
            - bpf_map_update_elem
            - bpf_map_delete_elem
    ...

    # bpftool --json --pretty feature probe kernel
    {
        ...
        "helpers": {
            "socket_filter_available_helpers": ["bpf_map_lookup_elem", \
                    "bpf_map_update_elem","bpf_map_delete_elem", ...
            ],
            "kprobe_available_helpers": ["bpf_map_lookup_elem", \
                    "bpf_map_update_elem","bpf_map_delete_elem", ...
            ],
            ...
        }
    }

v5:
- In libbpf.map, move global symbol to the new LIBBPF_0.0.2 section.

v4:
- Use "enum bpf_func_id" instead of "__u32" in bpf_probe_helper()
  declaration for the type of the argument used to pass the id of
  the helper to probe.
- Undef BPF_HELPER_MAKE_ENTRY after using it.

v3:
- Do not pass kernel version from bpftool to libbpf probes (kernel
  version for testing program with kprobes is retrieved directly from
  libbpf).
- Dump one list of available helpers per program type (instead of one
  list of compatible program types per helper).

v2:
- Move probes from bpftool to libbpf.
- Test all program types for each helper, print a list of working prog
  types for each helper.
- Fall back on include/uapi/linux/bpf.h for names and ids of helpers.
- Remove C-style macros output from this patch.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2019-01-22 22:15:40 -08:00
..
bash-completion bpftool: add bash completion for peek/push/enqueue/pop/dequeue 2019-01-17 10:30:32 +01:00
Documentation tools: bpftool: add probes for eBPF helper functions 2019-01-22 22:15:40 -08:00
.gitignore tools/bpftool: ignore build products 2018-07-26 02:50:26 +02:00
btf_dumper.c tools/bpf: support __int128 in bpftool map pretty dumper 2019-01-16 22:53:44 +01:00
cfg.c tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
common.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
feature.c tools: bpftool: add probes for eBPF helper functions 2019-01-22 22:15:40 -08:00
jit_disasm.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
json_writer.c tools: bpftool: fix -Wmissing declaration warnings 2018-12-15 01:31:49 +01:00
json_writer.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
main.c tools: bpftool: add basic probe capability, probe syscall availability 2019-01-22 22:15:40 -08:00
main.h tools: bpftool: add probes for eBPF map types 2019-01-22 22:15:40 -08:00
Makefile tools: bpftool: do not force gcc as CC 2018-12-19 21:57:25 +01:00
map_perf_ring.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
map.c tools: bpftool: add probes for eBPF map types 2019-01-22 22:15:40 -08:00
net.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
netlink_dumper.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
prog.c tools: bpftool: fix -Wmissing declaration warnings 2018-12-15 01:31:49 +01:00
tracelog.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
xlated_dumper.c tools: bpftool: fix -Wmissing declaration warnings 2018-12-15 01:31:49 +01:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00