bpflint

Crates.iobpflint
lib.rsbpflint
version0.1.3
created_at2025-06-30 22:27:12.965371+00
updated_at2025-09-24 18:48:30.391933+00
descriptionLinting functionality for BPF C programs.
homepage
repositoryhttps://github.com/d-e-s-o/bpflint
max_upload_size
id1732495
size830,221
Daniel Müller (d-e-s-o)

documentation

https://docs.rs/bpflint

README

pipeline crates.io Docs

bpflint

Linting functionality for BPF C kernel programs. The Linux kernel's BPF sub-system is continuously being improved and certain patterns recommended in the past may no longer be state-of-the-art today. Similarly, some "foot guns" exist that by definition may not be obvious to new comers.

bpflint contains a linter for BPF C kernel programs that accepts such a .bpf.c file as input and scans it for such known issues, pointing them out and providing recommendations on how to fix them.

Provided is a Rust library, a command line interface, a Web UI, as well as a GitHub Action for linting of BPF C programs.

📚 Frequently Asked Questions (FAQ)

Q: I am interested in helping out. How can I get started?

A: We have a list of issues with ideas for contributions, which mark a good starting point. For documentation on lints specifically and how to add a new one, please check out the lints/ sub-directory. All other questions are probably best asked in one of the existing issues (or a new one).

Q: I have a repository with BPF code, can I lint contributions easily?

A: If you are using GitHub Actions as the continuous integration solution of choice, you can add a separate job using the lint-bpf Action. For other CI systems some manual plumbing will be necessary. We provide statically linked bpflinter CLI binaries that can be downloaded from each cli-vX.Y.Z release and used directly on any Linux. E.g., https://github.com/d-e-s-o/bpflint/releases/download/cli-v0.1.2/bpflinter-x86_64-unknown-linux-musl

Q: I got a false-positive, what can I do?

A: Some lints require context that is not possible or feasible for the linter to acquire. E.g., kprobe attach point usage may be flagged as being an unstable attach point, but the linter cannot know whether a better alternative, say, in the form of a tracepoint, exists. bpflint recognizes C comments of the following form on blocks and statements: /* bpflint: disable=<lint-name> */ When encountered, the named lint will be disabled for the directly following item (block, statement, ...).

Commit count: 111

cargo fmt