netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 03/10] netfilter: conntrack: initialize ct->timeout
Date: Mon, 22 Apr 2019 22:47:54 +0200	[thread overview]
Message-ID: <20190422204801.26321-4-pablo@netfilter.org> (raw)
In-Reply-To: <20190422204801.26321-1-pablo@netfilter.org>

From: Alexander Potapenko <glider@google.com>

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

Signed-off-by: Alexander Potapenko <glider@google.com>
Fixes: cc16921351d8ba1 ("netfilter: conntrack: avoid same-timeout update")
Cc: Florian Westphal <fw@strlen.de>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_conntrack_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 82bfbeef46af..a137d4e7f218 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1350,6 +1350,7 @@ __nf_conntrack_alloc(struct net *net,
 	/* save hash for reusing when confirming */
 	*(unsigned long *)(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev) = hash;
 	ct->status = 0;
+	ct->timeout = 0;
 	write_pnet(&ct->ct_net, net);
 	memset(&ct->__nfct_init_offset[0], 0,
 	       offsetof(struct nf_conn, proto) -
-- 
2.11.0


  parent reply	other threads:[~2019-04-22 20:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 20:47 [PATCH 00/10] Netfilter/IPVS fixes for net Pablo Neira Ayuso
2019-04-22 20:47 ` [PATCH 01/10] selftests: netfilter: check icmp pkttoobig errors are set as related Pablo Neira Ayuso
2019-04-22 20:47 ` [PATCH 02/10] netfilter: conntrack: don't set related state for different outer address Pablo Neira Ayuso
2019-04-22 20:47 ` Pablo Neira Ayuso [this message]
2019-04-22 20:47 ` [PATCH 04/10] ipvs: do not schedule icmp errors from tunnels Pablo Neira Ayuso
2019-04-22 20:47 ` [PATCH 05/10] netfilter: ctnetlink: don't use conntrack/expect object addresses as id Pablo Neira Ayuso
2019-04-22 20:47 ` [PATCH 06/10] netfilter: nf_tables: prevent shift wrap in nft_chain_parse_hook() Pablo Neira Ayuso
2019-04-22 20:47 ` [PATCH 07/10] netfilter: nat: fix icmp id randomization Pablo Neira Ayuso
2019-04-22 20:47 ` [PATCH 08/10] netfilter: ebtables: CONFIG_COMPAT: drop a bogus WARN_ON Pablo Neira Ayuso
2019-04-22 20:48 ` [PATCH 09/10] netfilter: never get/set skb->tstamp Pablo Neira Ayuso
2019-04-22 20:48 ` [PATCH 10/10] netfilter: fix nf_l4proto_log_invalid to log invalid packets Pablo Neira Ayuso
2019-04-23  4:25 ` [PATCH 00/10] Netfilter/IPVS fixes for net David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190422204801.26321-4-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).