All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log
@ 2023-05-16 18:04 Andrii Nakryiko
  2023-05-17  5:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2023-05-16 18:04 UTC (permalink / raw)
  To: bpf, ast, daniel, martin.lau
  Cc: andrii, kernel-team, syzbot+8b2a08dfbd25fd933d75

It's trivial for user to trigger "verifier log line truncated" warning,
as verifier has a fixed-sized buffer of 1024 bytes (as of now), and there are at
least two pieces of user-provided information that can be output through
this buffer, and both can be arbitrarily sized by user:
  - BTF names;
  - BTF.ext source code lines strings.

Verifier log buffer should be properly sized for typical verifier state
output. But it's sort-of expected that this buffer won't be long enough
in some circumstances. So let's drop the check. In any case code will
work correctly, at worst truncating a part of a single line output.

Reported-by: syzbot+8b2a08dfbd25fd933d75@syzkaller.appspotmail.com
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 kernel/bpf/log.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c
index 046ddff37a76..850494423530 100644
--- a/kernel/bpf/log.c
+++ b/kernel/bpf/log.c
@@ -62,9 +62,6 @@ void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt,
 
 	n = vscnprintf(log->kbuf, BPF_VERIFIER_TMP_LOG_SIZE, fmt, args);
 
-	WARN_ONCE(n >= BPF_VERIFIER_TMP_LOG_SIZE - 1,
-		  "verifier log line truncated - local buffer too short\n");
-
 	if (log->level == BPF_LOG_KERNEL) {
 		bool newline = n > 0 && log->kbuf[n - 1] == '\n';
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log
  2023-05-16 18:04 [PATCH bpf-next] bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log Andrii Nakryiko
@ 2023-05-17  5:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-17  5:40 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, ast, daniel, martin.lau, kernel-team, syzbot+8b2a08dfbd25fd933d75

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Tue, 16 May 2023 11:04:09 -0700 you wrote:
> It's trivial for user to trigger "verifier log line truncated" warning,
> as verifier has a fixed-sized buffer of 1024 bytes (as of now), and there are at
> least two pieces of user-provided information that can be output through
> this buffer, and both can be arbitrarily sized by user:
>   - BTF names;
>   - BTF.ext source code lines strings.
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log
    https://git.kernel.org/bpf/bpf-next/c/cff36398bd4c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-17  5:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 18:04 [PATCH bpf-next] bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log Andrii Nakryiko
2023-05-17  5:40 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.