* [PATCH] bpf: fix a warning message in mark_ptr_not_null_reg()
@ 2021-02-16 19:36 Dan Carpenter
2021-02-16 21:10 ` KP Singh
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-02-16 19:36 UTC (permalink / raw)
To: Alexei Starovoitov, Dmitrii Banshchikov
Cc: Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, bpf, linux-kernel,
kernel-janitors
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 <dan.carpenter@oracle.com>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 056df6be3e30..bd4d1dfca73c 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -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");
}
}
--
2.30.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] bpf: fix a warning message in mark_ptr_not_null_reg()
2021-02-16 19:36 [PATCH] bpf: fix a warning message in mark_ptr_not_null_reg() Dan Carpenter
@ 2021-02-16 21:10 ` KP Singh
2021-02-17 0:37 ` Daniel Borkmann
0 siblings, 1 reply; 5+ messages in thread
From: KP Singh @ 2021-02-16 21:10 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexei Starovoitov, Dmitrii Banshchikov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, bpf, open list, kernel-janitors
On Tue, Feb 16, 2021 at 8:37 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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 <dan.carpenter@oracle.com>
> ---
> kernel/bpf/verifier.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 056df6be3e30..bd4d1dfca73c 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -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.
[...]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bpf: fix a warning message in mark_ptr_not_null_reg()
2021-02-16 21:10 ` KP Singh
@ 2021-02-17 0:37 ` Daniel Borkmann
2021-02-17 7:45 ` [PATCH v2 bpf-next] " Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2021-02-17 0:37 UTC (permalink / raw)
To: KP Singh, Dan Carpenter
Cc: Alexei Starovoitov, Dmitrii Banshchikov, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, bpf,
open list, kernel-janitors
On 2/16/21 10:10 PM, KP Singh wrote:
> On Tue, Feb 16, 2021 at 8:37 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>
>> 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 <dan.carpenter@oracle.com>
>> ---
>> kernel/bpf/verifier.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
>> index 056df6be3e30..bd4d1dfca73c 100644
>> --- a/kernel/bpf/verifier.c
>> +++ b/kernel/bpf/verifier.c
>> @@ -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.
>
> [...]
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().
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 bpf-next] bpf: fix a warning message in mark_ptr_not_null_reg()
2021-02-17 0:37 ` Daniel Borkmann
@ 2021-02-17 7:45 ` Dan Carpenter
2021-02-17 22:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2021-02-17 7:45 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Dmitrii Banshchikov,
bpf, linux-kernel, kernel-janitors
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().
Fixes: 4ddb74165ae5 ("bpf: Extract nullable reg type conversion into a helper function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Use WARN_ONCE().
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 1dda9d81f12c..3d34ba492d46 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -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");
}
}
--
2.30.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 bpf-next] bpf: fix a warning message in mark_ptr_not_null_reg()
2021-02-17 7:45 ` [PATCH v2 bpf-next] " Dan Carpenter
@ 2021-02-17 22:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-17 22:10 UTC (permalink / raw)
To: Dan Carpenter
Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
kpsingh, me, bpf, linux-kernel, kernel-janitors
Hello:
This patch was applied to bpf/bpf-next.git (refs/heads/master):
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 only WARN_ONCE().
>
> Fixes: 4ddb74165ae5 ("bpf: Extract nullable reg type conversion into a helper function")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> [...]
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-17 22:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 19:36 [PATCH] bpf: fix a warning message in mark_ptr_not_null_reg() Dan Carpenter
2021-02-16 21:10 ` KP Singh
2021-02-17 0:37 ` Daniel Borkmann
2021-02-17 7:45 ` [PATCH v2 bpf-next] " Dan Carpenter
2021-02-17 22:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).