Skip to content

Libbpf userspace function bpf_program__log_level

0.7.0

Get the verifier log level with which the BPF program was or will be loaded.

Definition

__u32 bpf_program__log_level(const struct bpf_program *prog);

Parameters

  • prog: BPF program to get the verifier log level of.

Return

The verifier log level of the BPF program.

#define BPF_LOG_LEVEL1  1
#define BPF_LOG_LEVEL2  2
#define BPF_LOG_STATS   4
#define BPF_LOG_FIXED   8

The log level is considered one value, so BPF_LOG_LEVEL1 or BPF_LOG_LEVEL2. BPF_LOG_STATS and BPF_LOG_FIXED are flags that can be combined with the log level.

BPF_LOG_LEVEL1

Print every instruction and verifier state at branch points.

BPF_LOG_LEVEL2

v5.2

Print every instruction and verifier state at every instruction

BPF_LOG_STATS

v5.2

Print verifier error and stats at the end of verification

BPF_LOG_FIXED

v6.4

Since kernel v6.4, the verifier log automatically rotates when it reaches the buffer size, writing over the start of the log, so the last lines are always in the log.

This flag disables the automatic rotation, so we see the start of the log until the buffer is full.

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome