diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2023-04-06 16:41:53 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2023-04-11 18:05:43 +0200 |
commit | 24bc80887adb4d6fc0057d4f14fabeaa4502b2a0 (patch) | |
tree | 3358cbc36e0e53f8512f00586215f715f0ed763a /kernel/bpf | |
parent | b1a7a480a1120d4f70305f5e8859f527e0efe4a5 (diff) | |
download | lwn-24bc80887adb4d6fc0057d4f14fabeaa4502b2a0.tar.gz lwn-24bc80887adb4d6fc0057d4f14fabeaa4502b2a0.zip |
bpf: Ignore verifier log reset in BPF_LOG_KERNEL mode
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>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Lorenz Bauer <lmb@isovalent.com>
Link: https://lore.kernel.org/bpf/20230406234205.323208-8-andrii@kernel.org
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c index 92b1c8ad6601..d99a50f07187 100644 --- a/kernel/bpf/log.c +++ b/kernel/bpf/log.c @@ -106,7 +106,7 @@ void bpf_vlog_reset(struct bpf_verifier_log *log, u64 new_pos) if (WARN_ON_ONCE(new_pos > log->end_pos)) return; - 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, |