Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1552953rwb; Fri, 19 Aug 2022 05:48:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR4zttVniI9+ySsuEO2y969piZpcWdosSQo2t5VzP1EGGEzHxGuvR/Ws7JWZOYyQM3Yv1pDl X-Received: by 2002:a17:907:6e29:b0:732:f72c:fdc3 with SMTP id sd41-20020a1709076e2900b00732f72cfdc3mr4737158ejc.241.1660913302436; Fri, 19 Aug 2022 05:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660913302; cv=none; d=google.com; s=arc-20160816; b=qeM9ZyZpbG45hweId5QlSOthlz0UneziqDVOXVB98YGzI+Ix9Qth3+/JtDFAuyXp6b o7AEhYFwL0wk4aW7lMUiR0eGkOx4mxCFj2pl1YTUJUT9ymXFwqiBHh8+dkeWFREURjqo A3M6rhEMikF6cWis66yslL2Ehh9tXcAWZvYAz9f+Uw6A2cN7X/PFWTevrnR8Lj3rFSxh WFXyE1FebSKtCBLtiPrOixbxaTNnki3hYv8Rl7GCix0Olk6BzsTm8V/pM08ius+0fc7A 0FR8ttsJpWE5OPZqQehzkbG2LYMqESkKHgMWDtfz14GUzhZZcWEhmXtsOaeHQhT0at4i 7HSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=/iikOqNQgXPeS3JrQ9IZ1uGMFtV2qNWmNJhl8RE/6xk=; b=mAFlKdxhVlN+wugqLYm1F09vfnvnJIUHCsck0ix+vGHa6akLJ1/4YbPsdQ97GKkvJL l19XHjxt2hnu8C7Y4gHhIV4ZY+arTvHlqvMclMn+o9+3k3iPrU1qebdFQVyIqi9hp9GX qLSRSJy19vYvNQTLgOqjy8YZXRfCh77TEro7z8f+l0YZ5CAG0Cxzuy3zt2iVUd+Y6KsP A+KzatMOEDJ//XqRDFbI1PnxJjjwvpU9fmxFMJ9KJEq2zP7N871OUf7n1tysuhYCDDXg OnRjj3m9BOBw9D0ig1NGw+2HguInwAHAfRFy0f5x17zdYg/BjIFLKo9dQje6AveKVpSi ClEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a1709064f0b00b007314bb5f757si2736190eju.370.2022.08.19.05.47.56; Fri, 19 Aug 2022 05:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348945AbiHSMgB (ORCPT + 99 others); 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) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.