Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1169178imm; Fri, 27 Jul 2018 12:19:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe+fCGriLovHU6EdYwWdxvwK8Fn2XVlvlCv3/ub1q5HxSEPqb7FCjWjjoYDjDZbA0ZpLQoN X-Received: by 2002:a63:e116:: with SMTP id z22-v6mr6978897pgh.89.1532719166134; Fri, 27 Jul 2018 12:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532719166; cv=none; d=google.com; s=arc-20160816; b=PCeDL7Ry5y/JzSKRc4uCD7ToEr9Qa4U5xBvM30zuMq5Dd9SJXP9ONoi4tR/+ZFT8gl h7rmIPyO7KWeD6Ud527jg0u5sQwJuPXRBZByNQTRMoQ93+PyD1ZGkDStncQiWWyTwSJ2 XU2ZNeYREujx4XoXWxydgA1OEBPpqSzNfVwqZKeYPrJ57fg3YTcgJabWLHP4I04W7VS0 +nxkf03HCqNqVnfzvuesRha1J7M+oit02BKxpOOOapWKfMe3HeRzkkUA/qFJgYgeTYYf PKBJzTTqLg3KZ+iu3av0FHapm+ok4ZJ4ox3MhPMCtA0o5ZiVEWqEm/O/4wx2XF+rU/Zn qEgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=RpDw/XmDaIM04LbzddUP0gbPjckYqsLIDUkF4UiuVeY=; b=M3A6Q9rg22Matl6ZDaQ8c36Y14BlBrod8pEsndN6wyGKcHv1/1z2fU0t+nMEYo+NJd w1DvWllKWt0rXp9ER4ztw8Bg1BkJpkOWb0JpVmdb7hhaGjfY23JUISpd/0sqpGv9y88N 7Sy7xGF1dPH7qFCZBIINU2d5eoVoN+b3B47M5NrofSioX/449OwnQhnHNQHS4obAXtpJ otrpaP09Mb8UPcGih0PdOYmn/xSF42Th7HcsB6LQJvzj97RMXw7/r3P1+h8P95CsF5De ijZwlzlJ3aOrMqsRVxqDhcMj+p+U85odtPmGgHi2uHLtmad8GT4PRqUx6s5P9FNc+co3 Xo1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kIwrEc6N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14-v6si3921408plp.489.2018.07.27.12.19.11; Fri, 27 Jul 2018 12:19:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kIwrEc6N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389266AbeG0Ukz (ORCPT + 99 others); Fri, 27 Jul 2018 16:40:55 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:38343 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388815AbeG0Ukz (ORCPT ); Fri, 27 Jul 2018 16:40:55 -0400 Received: by mail-it0-f68.google.com with SMTP id v71-v6so8822400itb.3 for ; Fri, 27 Jul 2018 12:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=RpDw/XmDaIM04LbzddUP0gbPjckYqsLIDUkF4UiuVeY=; b=kIwrEc6NTL/FEJpHYGyEZ92ofu5AuVF4cAsUVK9syb/XN+N7n3l85u1AimHsEkpz1G +/UJwRASP5yAAcrWBviWtpYAO/vOUHVcsBHMd4UeN55GGSNH8vbcgv5QcrTlaqPtuemF 1wclThMRnEOw4jCO/0AwHEaKAtCEGpEzNR3QpQhrw+pV3uxsUuDuNSJBXNMto/9mg6pq 1OFXzxSDF9DWpU8oZvLNOlDQJS5+ZbW1J47nXUXXj8iWJeEgI1wpX2oaIdnnIlOs/37j meTBGOXBnDPnK1AYHaYjV+bigeNyYBzL0aEnNM5q/+yXIqUcTo8cYynA+3ON0azIUtEw EaLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RpDw/XmDaIM04LbzddUP0gbPjckYqsLIDUkF4UiuVeY=; b=eg0RuXXmfb6fAnTGX5Z3hGVxxDROiauqwo43Dp/HR1Hb/nAWcM6iwY7rffEiarmobT c9qfKJo0zFWhf8sjQA3+W4TJ9iWKYut3Xl7H/2tYP/2yUIMcdl24ASJGuM1u96U/RzT5 kWq3yjwWKdvKIEcVL5HDvwTfXrEuX/Y9YvxIxTGoexKiZpi4Mna7KYkq4SNmlAAGBIj8 JrI2UjgL2sEOSfR4ybK8yaU8seuP7aeI3h6wvgeiEX9ZlDrkXyLxbUKhxWaQ6Uau7yBf KURB+cZUVUJKvUJAO2AkA+Eo4ZUmASnUsr/r9HltG5QqlsBwWT9hwW0Wa46Jw2mrIiis lNmQ== X-Gm-Message-State: AOUpUlEC6nlOL3nCPGnysrvJxxpjN7AhaTFl++iwF+NoUc/d7+Khnw+M 7DJX3XUBj0/qlp5zWPwaHbOk/SsC3VdRhD+xWvoz5g== X-Received: by 2002:a24:130c:: with SMTP id 12-v6mr6991213itz.35.1532719058675; Fri, 27 Jul 2018 12:17:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:ba01:0:0:0:0:0 with HTTP; Fri, 27 Jul 2018 12:17:37 -0700 (PDT) In-Reply-To: <20180714181815.GA199777@joelaf.mtv.corp.google.com> References: <951478560.1636.1531083278064.JavaMail.zimbra@efficios.com> <20180709210944.quulirpmv3ydytk7@ast-mbp.dhcp.thefacebook.com> <20180709221005.sintsjkle4xpkcyk@ast-mbp.dhcp.thefacebook.com> <20180709223439.uc2a6hyic35inwye@ast-mbp.dhcp.thefacebook.com> <20180710235252.mioihpgtu4n3syaq@ast-mbp.dhcp.thefacebook.com> <20180711034017.o2ehf27tv5hpl3td@ast-mbp.dhcp.thefacebook.com> <20180714181815.GA199777@joelaf.mtv.corp.google.com> From: Daniel Colascione Date: Fri, 27 Jul 2018 12:17:37 -0700 Message-ID: Subject: Re: [RFC] Add BPF_SYNCHRONIZE bpf(2) command To: Joel Fernandes Cc: Alexei Starovoitov , Lorenzo Colitti , Chenbo Feng , Mathieu Desnoyers , Joel Fernandes , Alexei Starovoitov , lkml , Tim Murray , Daniel Borkmann , netdev Content-Type: multipart/alternative; boundary="0000000000000910da0571fff7f8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000000910da0571fff7f8 Content-Type: text/plain; charset="UTF-8" On Sat, Jul 14, 2018 at 11:18 AM, Joel Fernandes wrote: > By the way just curious I was briefly going through kernel/bpf/arraymap.c. > How are you protecting against load-store tearing of values of array map > updates/lookups? > > For example, if userspace reads an array map at a particular index, while > another CPU is updating it, then userspace can read partial values / > half-updated values right? Since rcu_read_lock is in use, I was hoping to > find something like rcu_assign_pointer there to protect readers against > concurrent updates. Thanks for any clarification. I'm also curious about the answer to this question. --0000000000000910da0571fff7f8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On S= at, Jul 14, 2018 at 11:18 AM, Joel Fernandes <joel@joelfernandes.org= > wrote:
By the way just cu= rious I was briefly going through kernel/bpf/arraymap.c.
How are you protecting against load-store tearing of values of array map updates/lookups?

For example, if userspace reads an array map at a particular index, while another CPU is updating it, then userspace can read partial values /
half-updated values right? Since rcu_read_lock is in use, I was hoping to find something like rcu_assign_pointer there to protect readers against
concurrent updates.=C2=A0 Thanks for any clarification.
I'm also curious about the answer to this question.=C2=A0<= /div>
--0000000000000910da0571fff7f8--