Piyush Raj 7ee67c1388 contrib: add bpf-vmtest-tool to test BPF programs
This patch adds the bpf-vmtest-tool subdirectory under contrib which tests
BPF programs under a live kernel using a QEMU VM.  It can build the
specified kernel version with eBPF support enabled
and stores it under $VMTEST_DIR

It can test BPF C source files and precompiled BPF object files against
the kernel verifier for errors.
When a BPF program is rejected by the kernel verifier,
the verifier logs are displayed.

$ python3 main.py --log-level ERROR vmtest -k 6.15 --bpf-src fail.c
BPF program failed to load
Verifier logs:
        btf_vmlinux is malformed
        0: R1=ctx() R10=fp0
        0: (81) r0 = *(s32 *)(r10 +4)
        invalid read from stack R10 off=4 size=4
        processed 1 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

See the README for more examples.

The script uses vmtest (https://github.com/danobi/vmtest) to boot
the VM and run the program.  By default, it uses the host's root
("/") as the VM rootfs via the 9p filesystem, so only the kernel is
replaced during testing.

Tested with Python 3.9 and above.

contrib/ChangeLog:

	* bpf-vmtest-tool/README: New file.
	* bpf-vmtest-tool/bpf.py: New file.
	* bpf-vmtest-tool/config.py: New file.
	* bpf-vmtest-tool/kernel.py: New file.
	* bpf-vmtest-tool/main.py: New file.
	* bpf-vmtest-tool/pyproject.toml: New file.
	* bpf-vmtest-tool/tests/test_cli.py: New file.
	* bpf-vmtest-tool/utils.py: New file.
	* bpf-vmtest-tool/vm.py: New file.

Signed-off-by: Piyush Raj <piyushraj92739@gmail.com>
2026-02-24 21:34:48 +01:00
2026-02-16 00:16:25 +00:00
2026-02-22 00:16:27 +00:00
2026-02-23 00:16:26 +00:00
2026-02-24 00:16:30 +00:00
2026-02-24 00:16:30 +00:00
2026-02-24 00:16:30 +00:00
2026-02-13 00:16:32 +00:00
2026-02-13 00:16:32 +00:00
2026-02-20 00:16:32 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%