Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4216479pxf; Tue, 16 Mar 2021 08:14:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB8FAcvoQdftCVdGOsmVaBmYNhH27SL+uDEIicLyvkuIuVjkwv1UQq4TiudH/6g61Ou/tc X-Received: by 2002:a17:907:2513:: with SMTP id y19mr29894446ejl.241.1615907685877; Tue, 16 Mar 2021 08:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615907685; cv=none; d=google.com; s=arc-20160816; b=efitOy5Ds4wceB3Ia8QgQSgOGCLjorsF+ryiGKrU1pSL7PCZLrbPtFDZbxCxQ2AiN4 Os8LJZ+HimL6cUaO7YPc3WzPgxlA/oYIdnQ+Uz+3AGWQNkKMfDQIouhICK+S6Tp2s1EE 167SAHZsMedjywJuDZTlWlgnZ+EqtFS+DfgIb+mwmxGyIK06O5HhH03RhWJwBlpMR79M c3/0++bizVXvd/9ugA6oBudRPqbkzb/0CbzWhVhf/ct8zq3zziQbLBGyyGnO1Sy+Kvlf oW7LmVdSei7DZ09YxI9MJqE39265xfH7bVKQWrZkfBhAZ7mpPfmeypmE97oZ1lZX8OjZ qlog== 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=0BVUip21Kr45zEplSD8Ta+v48hgTWjvStS1Z9OIMqf0=; b=lECIKk4GBDUePRKSWYU33csSqQkcz69ZGcPfUsPHBhZwjPQ01pVAVrZzCc+5XhPhju Ji19o1ZUuiD+U9nACbExYMVuenjKFqjYMVfGP6peulbJ9ELTgcnfb9OfQFRaqRRthB+u utmny3jgVlPX5U0h/ZSCaDFBZb7K8QVw2jk/JKIOJZaoIcEP52sa4NhJf/YCWgurs/9+ cq4wbfAKpLe2SIIOt/hcvCneL2EwTQk1mNB56ZQbDmK8/Up1I5zb2DoL8MDN2pnso6g/ IdH60QVfNOhafwRKRCAc6IsoVLMpRD5FBi9IQeRIzcikiZH8gI7eMcIynJLWtbYME/md 6vew== 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 jz18si13103367ejc.575.2021.03.16.08.14.23; Tue, 16 Mar 2021 08:14:45 -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 S233399AbhCPJmK (ORCPT + 99 others); Tue, 16 Mar 2021 05:42:10 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:52002 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234461AbhCPJll (ORCPT ); Tue, 16 Mar 2021 05:41:41 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 269FD1C0B8B; Tue, 16 Mar 2021 10:41:38 +0100 (CET) Date: Tue, 16 Mar 2021 10:41:37 +0100 From: Pavel Machek To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: Re: [PATCH 4.19 011/120] tcp: annotate tp->copied_seq lockless reads Message-ID: <20210316094137.GA12946@amd> References: <20210315135720.002213995@linuxfoundation.org> <20210315135720.384809636@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline In-Reply-To: <20210315135720.384809636@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Greg Kroah-Hartman >=20 > From: Eric Dumazet Two From: fields here. > [ Upstream commit 7db48e983930285b765743ebd665aecf9850582b ] >=20 > There are few places where we fetch tp->copied_seq while > this field can change from IRQ or other cpu. And there are few such places even after the patch is applied; I quoted them below. Doing addition to variable without locking... is kind of interesting. Are you sure it is okay? > @@ -2112,7 +2112,7 @@ int tcp_recvmsg(struct sock *sk, struct > if (urg_offset < used) { > if (!urg_offset) { > if (!sock_flag(sk, SOCK_URGINLINE)) { > - ++*seq; > + WRITE_ONCE(*seq, *seq + 1); > urg_hole++; > offset++; > used--; > @@ -2134,7 +2134,7 @@ int tcp_recvmsg(struct sock *sk, struct > } > } > =20 > - *seq +=3D used; > + WRITE_ONCE(*seq, *seq + used); > copied +=3D used; > len -=3D used; > =20 > @@ -2163,7 +2163,7 @@ skip_copy: > =20 > found_fin_ok: > /* Process the FIN. */ > - ++*seq; > + WRITE_ONCE(*seq, *seq + 1); > if (!(flags & MSG_PEEK)) > sk_eat_skb(sk, skb); > break; Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --jRHKVT23PllUwdXP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmBQfVEACgkQMOfwapXb+vJ9VgCfY34c39nassZfZh50cm1j60Ga R8gAoI7SBRhkbGI2pxLQRXw5I+v93yzD =dGFU -----END PGP SIGNATURE----- --jRHKVT23PllUwdXP--