Message ID | 20230404043659.2282536-8-andrii@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | BPF verifier rotating log | expand |
On Tue, Apr 4, 2023 at 5:37 AM Andrii Nakryiko <andrii@kernel.org> wrote: > > Verifier log position reset is meaningless in BPF_LOG_KERNEL mode, so > just exit early in bpf_vlog_reset() if log->level is BPF_LOG_KERNEL. > > This avoid meaningless put_user() into NULL log->ubuf. > > Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Lorenz Bauer <lmb@isovalent.com>
diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c index c931cf73f9fd..38b0f9e6d98d 100644 --- a/kernel/bpf/log.c +++ b/kernel/bpf/log.c @@ -104,7 +104,7 @@ void bpf_vlog_reset(struct bpf_verifier_log *log, u64 new_pos) char zero = 0; u32 pos; - if (!bpf_verifier_log_needed(log)) + if (!bpf_verifier_log_needed(log) || log->level == BPF_LOG_KERNEL) return; /* if position to which we reset is beyond current log window,
Verifier log position reset is meaningless in BPF_LOG_KERNEL mode, so just exit early in bpf_vlog_reset() if log->level is BPF_LOG_KERNEL. This avoid meaningless put_user() into NULL log->ubuf. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> --- kernel/bpf/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)