[PATCH] net/netfilter: use memset avoid infoleaks

cgel.zte@gmail.com posted 1 patch 4 years, 3 months ago
net/netfilter/xt_bpf.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] net/netfilter: use memset avoid infoleaks
Posted by cgel.zte@gmail.com 4 years, 3 months ago
From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

Use memset to initialize structs to preventing infoleaks
in __bpf_mt_check_bytecode

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 net/netfilter/xt_bpf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/xt_bpf.c b/net/netfilter/xt_bpf.c
index 849ac552a154..5750a68a2a3f 100644
--- a/net/netfilter/xt_bpf.c
+++ b/net/netfilter/xt_bpf.c
@@ -29,6 +29,7 @@ static int __bpf_mt_check_bytecode(struct sock_filter *insns, __u16 len,
 	if (len > XT_BPF_MAX_NUM_INSTR)
 		return -EINVAL;
 
+	memset(&program, 0x0, sizeof(program));
 	program.len = len;
 	program.filter = insns;
 
-- 
2.25.1
Re: [PATCH] net/netfilter: use memset avoid infoleaks
Posted by Florian Westphal 4 years, 3 months ago
cgel.zte@gmail.com <cgel.zte@gmail.com> wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use memset to initialize structs to preventing infoleaks
> in __bpf_mt_check_bytecode

What infoleak, care to elaborate?  I don't see where this gets
returned to userspace, its on-stack struct?