linux/tools/bpf/bpftool
Quentin Monnet 4567b983f7 tools: bpftool: add probes for kernel configuration options
Add probes to dump a number of options set (or not set) for compiling
the kernel image. These parameters provide information about what BPF
components should be available on the system. A number of them are not
directly related to eBPF, but are in fact used in the kernel as
conditions on which to compile, or not to compile, some of the eBPF
helper functions.

Sample output:

    # bpftool feature probe kernel
    Scanning system configuration...
    ...
    CONFIG_BPF is set to y
    CONFIG_BPF_SYSCALL is set to y
    CONFIG_HAVE_EBPF_JIT is set to y
    ...

    # bpftool --pretty --json feature probe kernel
    {
        "system_config": {
            ...
            "CONFIG_BPF": "y",
            "CONFIG_BPF_SYSCALL": "y",
            "CONFIG_HAVE_EBPF_JIT": "y",
            ...
        }
    }

v5:
- Declare options[] array in probe_kernel_image_config() as static.

v4:
- Add some options to the list:
    - CONFIG_TRACING
    - CONFIG_KPROBE_EVENTS
    - CONFIG_UPROBE_EVENTS
    - CONFIG_FTRACE_SYSCALLS
- Add comments about those options in the source code.

v3:
- Add a comment about /proc/config.gz not being supported as a path for
  the config file at this time.
- Use p_info() instead of p_err() on failure to get options from config
  file, as bpftool keeps probing other parameters and that would
  possibly create duplicate "error" entries for JSON.

v2:
- Remove C-style macros output from this patch.
- NOT addressed: grouping of those config options into subsections
  (I don't see an easy way of grouping them at the moment, please see
  also the discussion on v1 thread).

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 basic probe capability, probe syscall availability 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 kernel configuration options 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 basic probe capability, probe syscall availability 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 bpftool: add pop and dequeue commands 2019-01-17 10:30:32 +01: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