Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3203666pxt; Mon, 9 Aug 2021 20:28:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbIQSnmLYFNoc0R1sBibV1C6NVW/be0UC7NTU0VEJL1N3fOxUhoAm4LbYBkZ4T9LeV648X X-Received: by 2002:a6b:f813:: with SMTP id o19mr5073ioh.49.1628566123218; Mon, 09 Aug 2021 20:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628566123; cv=none; d=google.com; s=arc-20160816; b=M81kVPJTnuW0f0BSv08DhJ01bkgSPngW6egKnx4jRmI3tHtY52uZaW0em1yPW0wjsQ vZ7YwlGfhulgbG4tIl2LhsyJlgLn4bCuSxZoVPx+4JNBb8eMaVo4dlBoXigfJk1nTWpK zVLSOQrDPzmSk6fnMTzypkzQGKgXfM54nWZDeMggJz16V+oGAabewJMmdXqRuPD6YZrX bBXOOrVep+jCCBJYL+1QCmgRj9b6P+8kjDVB1eru/kRwRKVXYrsFsA3n3C2uWoHOtLlh +o4Kn64eOGFg3BCDfjEXb/zWpVtTDPGyaffI+KzFLDfpLYJO9+UErMcuJEmHXKNAvmnm EuJw== 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=RB0CBjwauQ8eDkx7MltcykDllkBtVn63SfRkHOrBvwY=; b=lv28RQRFnbGfTURysWVv7R2BS2jfNHNZHdWtHYSuueslAMcFCj+lgZEtoq9fz7SX+G hOOnxwIsIlZIC9V4s1cyNlsZm1EhQCuk3NX15xYwwekdWIOiTpWzc2gXx96ThCkNeWB9 O4GHa//p8KvPjLXHZGQznmEDhvsPEvcjJHqmzwi0NzUj0KxkuJmdLKTT4iiSuz/b8vi2 I2dYUo8iNcczhmyT99I6yCXGRipQ1kRDuUSsQHmVhvy+YxmuhAmDsiv9apePkIFRb6gU J36y8jDLWsHuGOyDfvQEKJE2sX8l/uZi3t1yiRHOkyMd08A251bOdPnFMeVDf2SQZquY nHEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o12si20874430ilu.155.2021.08.09.20.28.30; Mon, 09 Aug 2021 20:28:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233736AbhHIVkz (ORCPT + 99 others); Mon, 9 Aug 2021 17:40:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230039AbhHIVky (ORCPT ); Mon, 9 Aug 2021 17:40:54 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE45AC0613D3; Mon, 9 Aug 2021 14:40:33 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1mDD0V-0003Bz-D7; Mon, 09 Aug 2021 23:40:27 +0200 Date: Mon, 9 Aug 2021 23:40:27 +0200 From: Florian Westphal To: Pavel Skripkin Cc: Florian Westphal , syzbot , coreteam@netfilter.org, davem@davemloft.net, kadlec@netfilter.org, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, pablo@netfilter.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] KASAN: use-after-free Write in nft_ct_tmpl_put_pcpu Message-ID: <20210809214027.GQ607@breakpoint.cc> References: <000000000000b720b705c8f8599f@google.com> <20210809203916.GP607@breakpoint.cc> <2d002841-402c-2bc3-2b33-3e6d1cd14c23@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d002841-402c-2bc3-2b33-3e6d1cd14c23@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Skripkin wrote: > Dumb question: why per_cpu() will return 2 different pointers for CPU 1 and > CPU 0? As I understand for_each_possible_cpu() will iterate over all > CPUs which could ever be enabled. So, we can hit situation when 2 concurrent > processes call per_cpu() with same cpu value (*). Yes, that is what I was trying to say, the race is that we can have > 1 processes here ever since the global transaction mutex was removed in 2018. > Anyway, I think, moving locking a bit higher is good here, let's test it. I > will prepare a patch, if it will pass syzbot testing, thanks! It looks correct to me, thanks.