Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2889441lqt; Tue, 23 Apr 2024 05:03:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVA+7Ff3RzxPvxeg1N1APb9aW4abQhbaiOYi/TYcAEaVzWim0DWoDRSUipYJAKvBzL67XzBHkVtnMbVZqfTcT6nj34xXvVkzmzDPoPpw== X-Google-Smtp-Source: AGHT+IHTKrcALuL4XRATwIbrCCuy1AsZv1WfXvN8eZ5rEVbkD+aNXJ9+7UH5uz98QPvM+kNXRjAu X-Received: by 2002:a2e:87d5:0:b0:2da:7cac:a75e with SMTP id v21-20020a2e87d5000000b002da7caca75emr7691201ljj.22.1713873797047; Tue, 23 Apr 2024 05:03:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713873797; cv=pass; d=google.com; s=arc-20160816; b=PP+N61KsHhDaANBzyFf8nyvJ8Oi8qKZVcGV/CCByGY0fmUTW0SRN6XCNlrtbbiajTH VOFfME651l6U+OS5dORmjibPBZlk0rOXWdDHLtJ4sc6PKDI5cYBCNgIqhedEsk7m9IAF ObVyMihITNT44sksrCX+HN7jKP7D9HALwJ8djVYBRxrEQAexqty9E8nExa+Eioh/vqfs JNuQg/EO0qMZw4zRAN1RQDjWYRb7PuohhoAlhuD07ctTstBIAolu5oKeGcrvgvRvRytw +IvN8s8ThjllZceCN7RrwJqCueREyi9DFSfuXeQ6+4dtQ4MTZktMGf/FnZ1Rtrbjs3/c Y6Hw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:subject:cc:to:from :message-id:dkim-signature; bh=9/w/tzBWmQ5MmArL4N+CgRcqjaPmk49mqMX02OJXD2A=; fh=k6zVhuxqPGtsBPH295DW4uenuhlFvh5gYOAvQbxoDS8=; b=qZP9lGITn/cVLNq2A9xVDibyzxkubo+T5Xvh7fjzNrfBFHIefTgLTx1KSvNTDB9Sy0 OxunD9xe8KdFAifrTY8c2NQVsM69Ctj99pHr4O1ofqnhKlzbgKz4eDR7HB+nukd57Cmo U4gw82ApIE5HK7BPCL/bb8x43UIl+/el5xooP2E0r1jlcGCOZ7WsM1CA1uYEvR3c1fJH OewFPk+qEZBXZO86CIRSy2XvSpkE9Rc9EvjUmR3cO75ORD4J9YXq5wFZAZAEBP6EaRfQ KjXES/Zsrhx1Ffxma615cMQrPSeEsQ1YkXX3Csze+BD18Ss+kwf1BazJbSJRizrJscAE FjPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=sQyZJhxN; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-155104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a70-20020a509ecc000000b0056e48c6e11esi6998683edf.262.2024.04.23.05.03.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:03:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=sQyZJhxN; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-155104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C07AF1F222F1 for ; Tue, 23 Apr 2024 12:03:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C50B13C672; Tue, 23 Apr 2024 11:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="sQyZJhxN" Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6945D86267; Tue, 23 Apr 2024 11:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.210 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713873045; cv=none; b=mIVwwA+YW/luTu9jN0JIF62/tLcMDdz84F3ouG7G98xRjpbFFPhkkIFtt4K3VMxGPGHZB5JzzTp+tvIceMdPYoOl0RO6LMS7YA2ONTuqHhfHIbsKUvnVgSCif6Zc70BvEHfatyr1XUL3R0lf/6cBgQf0t29JU7+aM2Qj7vchxfc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713873045; c=relaxed/simple; bh=pRCyizJBXLafcgiLZimJVFcWKch621Tv6coNnmXpEbw=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=HjjAQcMbnsljVj0Iurn/GBflssN0uvr1hb9/83v284V9veSHJZDOcjCivnRjkPPQS+hA1hZmlKgpG1/ncCUkXd3fbO3mm85aztF28LitWBeQkFHMK9Xv0NWRCrYmBW3j4SGRRdstIgaZwW6q2kJ6CerujVNtbQLDCZxw2Cn9LWg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=sQyZJhxN; arc=none smtp.client-ip=162.62.57.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1713873032; bh=9/w/tzBWmQ5MmArL4N+CgRcqjaPmk49mqMX02OJXD2A=; h=From:To:Cc:Subject:Date; b=sQyZJhxNAKv139UYsDafubp+qax6vg4HZyCfQt4389bsNekIU8wMvfqKFggUrZYXu mIzB0ECyNn/dWvxwjZiEuiP519pxCrRdd0M4f9Y/mn/C99IlXiaDqpajo+l+iaoIFu YdVSdKj04rxqeSvTZzJz+8ovTAaYIowirJuyg6Mg= Received: from localhost.localdomain ([58.213.8.145]) by newxmesmtplogicsvrszb9-1.qq.com (NewEsmtp) with SMTP id C9C0D4D5; Tue, 23 Apr 2024 19:50:28 +0800 X-QQ-mid: xmsmtpt1713873028tyc2wg7ji Message-ID: X-QQ-XMAILINFO: MhK4DKsBP06icZ6vUiZ0AyWKbL8hEAKksNAHNakfhxrPXC70cEjOCWZa/sxygp kuQj+OxO7txQuk/IXFlt9sXae4kml6zc8mgK5OeTDWGTVJ6uoYtpMloRcGuEZ9i3d+XbOahiP9kX vB5OxRyAenN3N852Nag3v2IgpseG3NE3wkXJDedAUqLGjATWpyexrPs3j4SUl6BXP+MmMB3yrG7K s1gNZoRxA7NXZ3cIheGISx5tNPFdvnNsyJQSdelHAsYbJoJQgAPR8V+WTG+GEeoY6Rbzrs5AQTOh bkFtMDlsl3MDVhoGmLzAwTifnt5WWWac7svMwAbVsazk/rYReWlJ0n8JEONRJrUYWmMLfJ/h9wNR xROLstzvwc+j/djLysaFbyUI0PeURjIy23bX/0+D0dUP/D8dh4mZJKtBPEk+StEJU2a6GyShYwV+ 0x3pg50ZaOBzKnY/tJOVPJCYHY9JRAh8wMjwP6L8wNSlEbgUlPbof9EJBSsGFyZjb9TsUhm+E8SP 42GLah5/1l3CQAoUPhZLx5s5JR2ym0cWwP0pY9P0H+Rz9/+ptJw5yB3NrG1uWpTfiWM7gzfFQLk+ m1M2/VPN/q2LR2BmMboe/KjRV3qe9cVx25pQcRHWcJFVhyj4oLQ7JSjevttVrN0uAP+9Wy8I2jtl tzPjn64Qg7A2lfFI5aoBqYB3rn6ca8xRT0uvdNIBhduMxM2KefQOXjpxgOYbXLytg0fqc3pap5Fd TQeOrS2r5CJUXmofpW6rc6v9bbzdWCoJBtyeEjZZtZ+V5cieZfH0C4uFXxXU2clSm2SojQQjd3WK qGbR1M8y7rqNpmBDKkywccv+e7zey9l20tvStFBCGlVyQtjoBBs1mF74RcTAV2LLSyoKhLL+vm9J VxY2IjC2GBuX8V/V9OPLpwO4FUr0LDSpPyscMwtpNK9mDk7pUtEsGOCJUgNkojWQCynlZAFQVywd TXOyPIsfiyUYL4SIDD3QK9EWcLkckmoRaOG+B9v3kc089saNLibeoRXTHwFi3/bCJT2NL9gkhShS r4aB4GOmtnz55qVyMyRnAnON8Lh1k= X-QQ-XMRINFO: NI4Ajvh11aEj8Xl/2s1/T8w= From: linke li To: Cc: xujianhao01@gmail.com, linke li , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] netfilter: mark racy access on ext->gen_id Date: Tue, 23 Apr 2024 19:50:22 +0800 X-OQ-MSGID: <20240423115022.78748-1-lilinke99@qq.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In __nf_ct_ext_find(), ext->gen_id can be changed by nf_ct_ext_valid_post(), using WRITE_ONCE. Mark data races on ext->gen_id as benign using READ_ONCE. This patch is aimed at reducing the number of benign races reported by KCSAN in order to focus future debugging effort on harmful races. Signed-off-by: linke li --- net/netfilter/nf_conntrack_extend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c index dd62cc12e775..7f1a5e5f6646 100644 --- a/net/netfilter/nf_conntrack_extend.c +++ b/net/netfilter/nf_conntrack_extend.c @@ -141,7 +141,7 @@ void *__nf_ct_ext_find(const struct nf_ct_ext *ext, u8 id) if (!__nf_ct_ext_exist(ext, id)) return NULL; - if (this_id == 0 || ext->gen_id == gen_id) + if (this_id == 0 || READ_ONCE(ext->gen_id) == gen_id) return (void *)ext + ext->offset[id]; return NULL; -- 2.39.3 (Apple Git-146)