bpf: fix a warning message in mark_ptr_not_null_reg()
Subsystems (3)
PATCH 1/1 bpf: fix a warning message in mark_ptr_not_null_reg()
The WARN_ON() argument is a condition, and it generates a stack trace but it doesn't print the warning.
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -1120,7 +1120,7 @@ static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) reg->type =PTR_TO_RDWR_BUF ;break ;default : -WARN_ON ("unknown nullable register type" ); +WARN (1 ,"unknown nullable register type" ); } }
Signature · 1 line
2.30.0
Quoted 15 lines · Dan Carpenter
The
WARN_ON()argument is a condition, and it generates a stack trace but it doesn't print the warning.Fixes 4ddb74165ae5 ("bpf: Extract nullable reg type conversion into a helper function")Signed-off-by Dan Carpenter <[email protected]>--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/bpf/verifier.c +0
-0
kernel/bpf/verifier.c static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) · line 1123
Quoted 5 lines
kernel/bpf/verifier.c +1
-1@@ -1120,7 +1120,7 @@ static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) reg->type =PTR_TO_RDWR_BUF ;break ;default : -WARN_ON ("unknown nullable register type" ); +WARN (1 ,"unknown nullable register type" );
Should we use WARN_ONCE here? Also, I think the fix should be targeted for bpf-next as
the patch that introduced this hasn't made it to bpf yet.
[...]
Daniel Borkmann
maintainerQuoted 26 lines · KP Singh
Quoted 15 lines · Dan Carpenter
The
WARN_ON()argument is a condition, and it generates a stack trace but it doesn't print the warning.Fixes 4ddb74165ae5 ("bpf: Extract nullable reg type conversion into a helper function")Signed-off-by Dan Carpenter <[email protected]>--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/bpf/verifier.c +0
-0kernel/bpf/verifier.c static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) · line 1123
Quoted 5 lines
kernel/bpf/verifier.c +1
-1@@ -1120,7 +1120,7 @@ static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) reg->type =PTR_TO_RDWR_BUF ;break ;default : -WARN_ON ("unknown nullable register type" ); +WARN (1 ,"unknown nullable register type" );Should we use
WARN_ONCEhere? Also, I think the fix should be targeted for bpf-next as
the patch that introduced this hasn't made it to bpf yet.
Quoted 1 line
[...]
Usually we have something like verbose(env, "kernel subsystem misconfigured verifier\n"), but in this case we'd need to drag env all the way to here. :/ I agree with WARN_ONCE().
PATCH v2 1/1 bpf: fix a warning message in mark_ptr_not_null_reg()
The WARN_ON() argument is a condition, not an error message. So this code will print a stack trace but will not print the warning message. Fix that and also change it to only WARN_ONCE().
---
v2: Use WARN_ONCE().
kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -1120,7 +1120,7 @@ static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) reg->type =PTR_TO_RDWR_BUF ;break ;default : -WARN_ON ("unknown nullable register type" ); +WARN_ONCE (1 ,"unknown nullable register type" ); } }
Signature · 1 line
2.30.0
This patch was applied to bpf/bpf-next.git (refs/heads/master):
Hello:
This patch was applied to bpf/bpf-next.git (refs/heads/master):
Quoted 8 lines · On Wed, 17 Feb 2021 10:45:25 +0300 you wrote:
The
WARN_ON()argument is a condition, not an error message. So this code will print a stack trace but will not print the warning message. Fix that and also change it to onlyWARN_ONCE().Fixes 4ddb74165ae5 ("bpf: Extract nullable reg type conversion into a helper function")Signed-off-by Dan Carpenter <[email protected]>[...]
Here is the summary with links:
- [v2,bpf-next] bpf: fix a warning message in mark_ptr_not_null_reg()
https://git.kernel.org/bpf/bpf-next/c/7b1e385c9a48
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html