* [PATCH bpf-next] bpf, x86: initialize the variable "first_off" in save_args()
@ 2023-07-19 11:03 menglong8.dong
2023-07-19 17:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: menglong8.dong @ 2023-07-19 11:03 UTC (permalink / raw)
To: yhs
Cc: davem, dsahern, ast, daniel, andrii, martin.lau, song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, tglx, mingo, bp,
dave.hansen, x86, hpa, imagedong, netdev, bpf, linux-kernel,
Hao Peng, Dan Carpenter
From: Menglong Dong <imagedong@tencent.com>
As Dan Carpenter reported, the variable "first_off" which is passed to
clean_stack_garbage() in save_args() can be uninitialized, which can
cause runtime warnings with KMEMsan. Therefore, init it with 0.
Fixes: 473e3150e30a ("bpf, x86: allow function arguments up to 12 for TRACING")
Cc: Hao Peng <flyingpeng@tencent.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/bpf/09784025-a812-493f-9829-5e26c8691e07@moroto.mountain/
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
arch/x86/net/bpf_jit_comp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 5ab531be56ac..83c4b45dc65f 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -1925,7 +1925,7 @@ static int get_nr_used_regs(const struct btf_func_model *m)
static void save_args(const struct btf_func_model *m, u8 **prog,
int stack_size, bool for_call_origin)
{
- int arg_regs, first_off, nr_regs = 0, nr_stack_slots = 0;
+ int arg_regs, first_off = 0, nr_regs = 0, nr_stack_slots = 0;
int i, j;
/* Store function arguments to stack.
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf, x86: initialize the variable "first_off" in save_args()
2023-07-19 11:03 [PATCH bpf-next] bpf, x86: initialize the variable "first_off" in save_args() menglong8.dong
@ 2023-07-19 17:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-19 17:00 UTC (permalink / raw)
To: Menglong Dong
Cc: yhs, davem, dsahern, ast, daniel, andrii, martin.lau, song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, tglx, mingo, bp,
dave.hansen, x86, hpa, imagedong, netdev, bpf, linux-kernel,
flyingpeng, dan.carpenter
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Wed, 19 Jul 2023 19:03:30 +0800 you wrote:
> From: Menglong Dong <imagedong@tencent.com>
>
> As Dan Carpenter reported, the variable "first_off" which is passed to
> clean_stack_garbage() in save_args() can be uninitialized, which can
> cause runtime warnings with KMEMsan. Therefore, init it with 0.
>
> Fixes: 473e3150e30a ("bpf, x86: allow function arguments up to 12 for TRACING")
> Cc: Hao Peng <flyingpeng@tencent.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/bpf/09784025-a812-493f-9829-5e26c8691e07@moroto.mountain/
> Signed-off-by: Menglong Dong <imagedong@tencent.com>
>
> [...]
Here is the summary with links:
- [bpf-next] bpf, x86: initialize the variable "first_off" in save_args()
https://git.kernel.org/bpf/bpf-next/c/492e797fdab2
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-07-19 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19 11:03 [PATCH bpf-next] bpf, x86: initialize the variable "first_off" in save_args() menglong8.dong
2023-07-19 17:00 ` 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).