Re: [PATCH] netfilter: conntrack: initialize ct->timeout

From: Florian Westphal
Date: Thu Mar 28 2019 - 06:05:24 EST


Alexander Potapenko <glider@xxxxxxxxxx> wrote:
> KMSAN started reporting an error when accessing ct->timeout for the
> first time without initialization:
>
> BUG: KMSAN: uninit-value in __nf_ct_refresh_acct+0x1ae/0x470 net/netfilter/nf_conntrack_core.c:1765
> ...
> dump_stack+0x173/0x1d0 lib/dump_stack.c:113
> kmsan_report+0x131/0x2a0 mm/kmsan/kmsan.c:624
> __msan_warning+0x7a/0xf0 mm/kmsan/kmsan_instr.c:310
> __nf_ct_refresh_acct+0x1ae/0x470 net/netfilter/nf_conntrack_core.c:1765
> nf_ct_refresh_acct ./include/net/netfilter/nf_conntrack.h:201
> nf_conntrack_udp_packet+0xb44/0x1040 net/netfilter/nf_conntrack_proto_udp.c:122
> nf_conntrack_handle_packet net/netfilter/nf_conntrack_core.c:1605
> nf_conntrack_in+0x1250/0x26c9 net/netfilter/nf_conntrack_core.c:1696
> ...
> Uninit was created at:
> kmsan_save_stack_with_flags mm/kmsan/kmsan.c:205
> kmsan_internal_poison_shadow+0x92/0x150 mm/kmsan/kmsan.c:159
> kmsan_kmalloc+0xa9/0x130 mm/kmsan/kmsan_hooks.c:173
> kmem_cache_alloc+0x554/0xb10 mm/slub.c:2789
> __nf_conntrack_alloc+0x16f/0x690 net/netfilter/nf_conntrack_core.c:1342
> init_conntrack+0x6cb/0x2490 net/netfilter/nf_conntrack_core.c:1421

Acked-by: Florian Westphal <fw@xxxxxxxxx>