From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05ECEC32773 for ; Fri, 19 Aug 2022 12:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348925AbiHSMgB (ORCPT ); Fri, 19 Aug 2022 08:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348737AbiHSMf4 (ORCPT ); Fri, 19 Aug 2022 08:35:56 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87607D83E5; Fri, 19 Aug 2022 05:35:55 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1oP1Dy-0000rG-J3; Fri, 19 Aug 2022 14:35:42 +0200 Date: Fri, 19 Aug 2022 14:35:42 +0200 From: Florian Westphal To: Abhishek Shah Cc: coreteam@netfilter.org, davem@davemloft.net, edumazet@google.com, fw@strlen.de, kadlec@netfilter.org, kuba@kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, pabeni@redhat.com, pablo@netfilter.org, Gabriel Ryan , linux-kernel@vger.kernel.org Subject: Re: data-race in nf_tables_newtable / nf_tables_newtable Message-ID: <20220819123542.GA2461@breakpoint.cc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Abhishek Shah wrote: > Hi all, > > We found a race involving the table->handle variable here > . > This race advances the pointer, which can cause out-of-bounds memory > accesses in the future. Please let us know what you think. > > Thanks! > > > *---------------------Report-----------------* > *read-write* to 0xffffffff883a01e8 of 8 bytes by task 6542 on cpu 0: > nf_tables_newtable+0x6dc/0xc00 net/netfilter/nf_tables_api.c:1221 > nfnetlink_rcv_batch net/netfilter/nfnetlink.c:513 [inline] [..] > *read-write* to 0xffffffff883a01e8 of 8 bytes by task 6541 on cpu 1: > nf_tables_newtable+0x6dc/0xc00 net/netfilter/nf_tables_api.c:1221 > nfnetlink_rcv_batch net/netfilter/nfnetlink.c:513 [inline] [..] I don't understand. Like all batch operations, nf_tables_newtable is supposed to run with the transaction mutex held, i.e. parallel execution is not expected. There is a lockdep assertion at start of nf_tables_newtable(); I don't see how its possible that two threads can run this concurrently.