Received: by 2002:ab2:5d18:0:b0:1ef:7a0f:c32d with SMTP id j24csp176389lqk; Sat, 9 Mar 2024 05:35:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUY8m0wLO1EAGAuZEFyI3Ep1l/ICsTE81SvVkk8HYvnaGrIhLBa6tZAVfWCc9ZQMLrwNua5/h7EkZ2yWA/onKiPoz4i398xI4HDa0BWpQ== X-Google-Smtp-Source: AGHT+IHLpHDWvcaGkxJjbyDlMdPYWHSyxAvZT+bMnXRRcYUdH9YHyjCaveAkU2vFa+3zxVrLJl9l X-Received: by 2002:a05:622a:8:b0:42e:f60c:66f with SMTP id x8-20020a05622a000800b0042ef60c066fmr2509896qtw.52.1709991343262; Sat, 09 Mar 2024 05:35:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709991343; cv=pass; d=google.com; s=arc-20160816; b=fVlKqFVVSqRqHVp0VsIrpoYgU6Ztwsxv1fM9u9EIP4akpMMTJsoUv7WvdXFogxyqE2 oLXvnjQLIM1jPvGz5FIBxD5tk676bKgTKNNllXOVn6CvZBixYsDOHIWPV1/IOMK87W0r y0mpTgadQ+AjFCEYsBTT+wGlab6lbY9/tC2u2rQ6hdhSv9We+g4M8Xb14ww+JkigRu19 /1PS9l1E/sMyKP/ri+buKifu96PGOrhltFk97LKd4pQhq7OCvc5mgsoq8sOF/POMdQdH vNZqSpQSHElxdb6f9i+0E7uUKHHT7Q2Z3mfvPjrDdtZjBhcF0kTc9vQDGI9nzPLNdbtu co0A== 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=JMJZZGhWptagNBPaY3ce0VzBpB5bhSnhY8q1A69wfqY=; fh=vPFCKFELBw0Kfz6DXM+NYyd0MKRyC58qYq5grjQXtmU=; b=DY+MH6lPXtyxjLekhDrTjJ0VcmBBCVs9v66xBcyCu9826d7sHJJGFNcK6pA6RlqAZ+ +YjSmCHYjurLkkxv/ev3/afwOvUPOlwmaKLdC3CYY+oHWlh3MUycx0NkQFUffS1Bu5mW YYhb6hRaQZxmGcf8V2qm5pWaG4Nuyqzal6g6QgBIMSOsWSSKUo+0T6i3lIO/AAmrgDWU DmV0+qW/7cZEGoBT2zL+dvRi6kmPmW8+K528qXTzpw/gg3eGYLXUfV2+k9IvEglQJhfk pOXYUyrGF5P5Vj2DTuUc1nYvr5DFHujLmfyhJxGX52Ob0Ei5oLR+/uOXDJxCri7pTLC5 ZFPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=AITJw5sn; 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-97908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97908-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v14-20020ac8578e000000b0042eef41e212si1623794qta.346.2024.03.09.05.35.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 05:35:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=AITJw5sn; 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-97908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97908-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F2C9B1C20D05 for ; Sat, 9 Mar 2024 13:35:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F45B3C6BA; Sat, 9 Mar 2024 13:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="AITJw5sn" Received: from out203-205-221-239.mail.qq.com (out203-205-221-239.mail.qq.com [203.205.221.239]) (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 023501BDF4; Sat, 9 Mar 2024 13:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.239 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709991334; cv=none; b=nPmU6VE+XGbCSt3gbV7GORH5FgKJEaLOS/1kBqc+PUtaxBFifNKZYVUN+HZLx5cR6Pu/2RnwKdiIzY64KuUVajjAbZ+OfaAkMd7vpYMKzuz8SV9ENZdnlOKBj671AbtGAhH8VLavWsMP7cSYo8mKbQFFKGUc7pS58gkzytQDpDI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709991334; c=relaxed/simple; bh=i4kQuAnoQeqypHuwMZ5OqixyBUFX6jZIIa7F8n2+mkU=; h=Message-ID:From:To:Cc:Subject:Date:MIME-Version; b=oRUBI+EmY1k3wV3/LlCTYAK1CcT6rLp99UL1d6Wdh/LDSW/HMioMISnW/kWp/DtL+sB0Z6fCwxZCT5HWMsSH3JP9C9EXLO9MBje+/06ObgdRr/LZHSiuyp1EKDCaMc7LJBZAsy/lf6wn4rcABxbHztYf6ZY6K4fqBQ7fwlw27Dw= 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=AITJw5sn; arc=none smtp.client-ip=203.205.221.239 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=1709991319; bh=JMJZZGhWptagNBPaY3ce0VzBpB5bhSnhY8q1A69wfqY=; h=From:To:Cc:Subject:Date; b=AITJw5snACaYV5znEiAektOXX8O4Da0g2VuVbaVAfnc0fKDRrNH8pjqupHsR7jcn8 Y4laKQM+MFE3acqtFwlOmv+m+YsKVAvrWcmu6+i7qcZaLfmWEzNlZoGp5ntcp5driS /tAZaXNTMEkcyoZdo4DFMelSp44xpnQfWkFCTM+I= Received: from localhost.localdomain ([58.213.8.163]) by newxmesmtplogicsvrszc5-2.qq.com (NewEsmtp) with SMTP id 8CF87847; Sat, 09 Mar 2024 21:35:15 +0800 X-QQ-mid: xmsmtpt1709991315t3dwksqcz Message-ID: X-QQ-XMAILINFO: NvH2zBBgt3uT+kfoe/499o2G21ybEH6CIxd21cVVkXPbT/F/r+w8/YH+9VZgrL MqsAtBLT0sFgV0dUTf8JJ932HwN45u0yIjh1k0VPIduK4hFIZaukEFYWuRd8FxzOUJZOhDUMbkgJ qhZ/TGPRrryANjn9fIUIgq9ucdOL1pLT7QwM5w1UZE6TUiXucuX9JWK/giiHD2oU3DKXlFsLN/tI 5Nn5Yc91wl/mStke/F3i5QDaD1SJ/UK6vT7hRY8gUUdCBAkbA5TajnTi6FSRJRG2DqYznfja7hqY ZXY/aEWlxzBjUbKiqDOFXxSd8v0zoTKcaVU2D83y0HDxWVO/nKVkWaJMTENfpiUKF/6c8VdaP1zP A8ix2sqYYy3oTzUK4c49e8uo7A0xTfx/AL7K/JHSB2hFiE/cfqeGk3R9ALd+4mHmevCfjQrbzNCX DZttcjGb8kI//vx8XqIAOldipwg2VMMfcbIbwrw5i5FfiHEFcE5q1LMxLtZq3mERSkoSqE5JiWwt 0MJJLj89XfHq/4TonNctw+XXJCqQ7F8z8J3D3hxPueK5gas8gaXeSQQ2mJojRwN7YjHnTXqDbpCq wCTyoxNHaaDRRuNS7VRfrLeRbAZ2KUM17CieqwXftpHYeAHIZdVAZoGNuSMKRpds4vKsrPvEGv36 rFniflqNSXzUcFwqQB0cPm+01FTetN4UEJuCqaT2yVO4nfSmVhUPLmd2vKrD5w4pwYwbM1bmTJyB PNpwlDvvwX2VJTII4v50D0Nrf303ZUkwBpdv9Xpds4yyTe/x+mQzxxqixzGJMxtEoH1VSMdKX//6 eTYU+g9NVVmPZ0UukOVZNkqSJZt7jbrL66Es3ukLpu2SJH3gmpxLtBiyTTD2RtscBPsCidYN/cY0 tLdAIt2HtMkFPQhINIBOg0FgyNhRh8wRdDqDloYcNx8HGJ4gX3QTjWduSE+PmKwIHnepCZyZy5dl hb21oXZeZOUQMeQrM5d6PECYjQjQbtI+aJsxjOnYiaBFo6PUESJ8m2vWrYDsSoy1X2ogTerg4QLj 8u+31VZrkEdOLcSgkwkrRUCUA2K+d5t00v2byNtKDYAS/jl0ZdITFH0M/3Img= X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: linke li To: Cc: lilinke99@qq.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kuniyuki Iwashima , Willem de Bruijn , Abel Wu , Breno Leitao , Alexander Mikhalitsyn , David Howells , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: mark racy access on sk->sk_rcvbuf Date: Sat, 9 Mar 2024 21:34:40 +0800 X-OQ-MSGID: <20240309133444.56863-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 sk->sk_rcvbuf can be changed by other threads. Mark this 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/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 5e78798456fd..4c5524e70534 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -551,7 +551,7 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, skb->dev = NULL; - if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) { + if (sk_rcvqueues_full(sk, READ_ONCE(sk->sk_rcvbuf))) { atomic_inc(&sk->sk_drops); goto discard_and_relse; } -- 2.39.3 (Apple Git-146)