xref: /linux/kernel/bpf/diagnostics.h (revision daf8248701b621d8df7ea134793dbb750d4887c0)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
3 
4 #ifndef __BPF_DIAGNOSTICS_H
5 #define __BPF_DIAGNOSTICS_H
6 
7 #include <linux/compiler_attributes.h>
8 #include <linux/stdarg.h>
9 #include <linux/types.h>
10 
11 struct bpf_verifier_env;
12 
13 bool bpf_diag_enabled(const struct bpf_verifier_env *env);
14 int bpf_diag_init(struct bpf_verifier_env *env);
15 char *bpf_diag_fmt_buf(struct bpf_verifier_env *env, size_t size);
16 const char *bpf_diag_vfmt(struct bpf_verifier_env *env, const char *fmt, va_list args)
17 	__printf(2, 0);
18 const char *bpf_diag_fmt(struct bpf_verifier_env *env, const char *fmt, ...) __printf(2, 3);
19 u64 bpf_diag_event_log_save(struct bpf_verifier_env *env);
20 void bpf_diag_event_log_restore(struct bpf_verifier_env *env, u64 log_pos);
21 void bpf_diag_free(struct bpf_verifier_env *env);
22 void bpf_diag_record_branch(struct bpf_verifier_env *env, u32 insn_idx, bool cond_true);
23 
24 #endif /* __BPF_DIAGNOSTICS_H */
25