Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1337904ybl; Fri, 13 Dec 2019 13:35:26 -0800 (PST) X-Google-Smtp-Source: APXvYqyuTMMY5XI5Tw3sCQH93M4iq9mtAFNM04gjrHPXrfo04vAR7Zx3Ed8wCIL1QiFDNEbEevPl X-Received: by 2002:a9d:7586:: with SMTP id s6mr16665950otk.342.1576272926050; Fri, 13 Dec 2019 13:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576272926; cv=none; d=google.com; s=arc-20160816; b=HPq0LbM9gowM6zSrMTX+tsPR3KlUOcf7hqNt/P6CuzdONUfWFG+67V9oNHpPCycpUT 2Lb8ju3NO4p8NhkXc9i9ClJlRwBlRrNMSbevOyOj3G7nfIuAU0J7FA1/fJ57ElJdjf0G Nq+BHTljOXF62jHLRP7R5cce7pVgChhZBrgMZJl/1kjZ6Ny9+IHeh54Zar7ZGt0v9X9T 7k9e4xF6eo4dWysNcA8jfeOTaoD8vF5m/mxvTyBa6e1D3HDhE047P9XivXtGVMay4jUd U6LEjUgmBx3h/vQKT5AEo1Wly9leWy9Duwdq/o/A+TQEtL5rVsV2dS1I0r0tq4BeAfTO jsHQ== 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 :in-reply-to:references:mime-version; bh=GxDN7QKDpgFhdmg3lKEI8abnkPGJu/jrqaX2KDs6Rg0=; b=LGesYokrW3keyfgLSo7tZPppD8SgRGUPFnaSd+ww2cOHA4Az1nklLocCuy22YE1ERh TY10VphbT0qk7Wjj/U4rymdK6OWgdiwLCOvN1jzxtI9VoQY/xZ32WJM17ot/xMSOXnwu QajU3fN/SS3zzIdNEVxfB/who5W+3URd0o5hutWxauxQfqk9UmgAA7N2owGlaOzY+hT6 /jpYYE6+e9x2N0Lr93ZLDHxyGS1ZN7A4V/rfVxmpJpv0tlT4Y6KbKgrYkdKiQTolDO0X yv6SHdg8BIceaehdbrY/FFsG3vX8QPoJzPAIVV2TkgLDs0s59I+BuLufdWD3bf/poRrT hyhQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si5852132oif.255.2019.12.13.13.35.14; Fri, 13 Dec 2019 13:35:26 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726735AbfLMVdH (ORCPT + 99 others); Fri, 13 Dec 2019 16:33:07 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:38607 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbfLMVdH (ORCPT ); Fri, 13 Dec 2019 16:33:07 -0500 Received: from mail-qv1-f52.google.com ([209.85.219.52]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPSA (Nemesis) id 1N0X4e-1hjoHt3CJY-00wTtK; Fri, 13 Dec 2019 22:33:05 +0100 Received: by mail-qv1-f52.google.com with SMTP id t9so319741qvh.13; Fri, 13 Dec 2019 13:33:05 -0800 (PST) X-Gm-Message-State: APjAAAXfCTEfs5zqNZffgfa1NTymJUN9kz81+abqorsqbAZ/peGOEhlJ ZCFaiBPpDezIK6BB2EGiG9cXKAgXUH0JKBTwxzI= X-Received: by 2002:a0c:aca2:: with SMTP id m31mr15739114qvc.222.1576272784583; Fri, 13 Dec 2019 13:33:04 -0800 (PST) MIME-Version: 1.0 References: <87blslei5o.fsf@mpe.ellerman.id.au> <20191206131650.GM2827@hirez.programming.kicks-ass.net> <875zimp0ay.fsf@mpe.ellerman.id.au> <20191212080105.GV2844@hirez.programming.kicks-ass.net> <20191212100756.GA11317@willie-the-truck> <20191212104610.GW2827@hirez.programming.kicks-ass.net> <20191212180634.GA19020@willie-the-truck> <20191212193401.GB19020@willie-the-truck> In-Reply-To: From: Arnd Bergmann Date: Fri, 13 Dec 2019 22:32:48 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: READ_ONCE() + STACKPROTECTOR_STRONG == :/ (was Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.5-2 tag (topic/kasan-bitops)) To: Linus Torvalds Cc: Will Deacon , Peter Zijlstra , Michael Ellerman , Daniel Axtens , Linux Kernel Mailing List , linuxppc-dev , Christophe Leroy , linux-arch , Mark Rutland , Segher Boessenkool , Christian Borntraeger Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:FdXVnilKksLQLV1wzuAn1Esf8CicNBfi5v9XB/3emD6G0GJG4+S ft0zSdL6XWPzgsIkHJp8BODgVJjytSWWLaBQ0a582j9cc8nVGuzjH2v0vBReXWD88GPddI8 FjhWmFChZ/vy8YWpbHbf1M1JWgEdPiaSz4x7KkcoBdUbrgVcU4FylFPFPqDOz4NcxddXJ1W ltEsARmVTm/Y6yHckFRRw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:YFAe+6A9cTM=:Zvky+XzJsJ322S4cP0pg6i 86yBNT9R+qQvN1z0XLu1qYzbYWamXOzhuIETZG4TzscrcO/j8IZUgEh1udCOYE+Q6g8vKCGY4 WuZJlFDAlZG/u7YTV+g8Sh5n6xb+6DQUIaCkfbClcxgG/7oAiXZXur9/PGObWszYPHdHvzMiP 4HVO3PyLsexxLM9aGHC1qeAMU7wFUKCoYkWgpV9AsMSZq36pWH8Tn8+zEVFhr5WmN5luNmiy8 wYjuqhmZmGgJt+GldlWvCfTC1OL2ggGDnP+IrmtPXh5UcMaStp5rdtgyxlp/KTv2ab/PspqZ3 nFeYhu9fpPSv2/xJoAcAG03zA0+fVKzyiODG8rWOYqNzrWuNNImfzvn9LxW6JzNhEecZh8yX3 C98KdPgUYQK9tRxSnV03jBTmfTTms8uHboe3aQmOIEfFIcQj7pYux/6jcq+jFaBpGkNILxG9p 8AMb8fDbwdaYS1H2Is6fmcOTS59DsBR5612mlApK4nDAqip/JemqF0JhuDyQXkKdcfX2aS2up e3iv2rLXuHQuqKgnRQ/fooZnPHazphhiW72Dogh8fWTpMc5pk5Juu1JLgNRn1iBrPbmGVWZCC 2o6wbaFn3RTiPS55IBpWNjlkFJBJ07Mq9DuwcHmTDpbsxw6nqtWbTKD0JlKbO+L0Pb5BOj7ZA qI4iFcj6IWnZxj4SxiIfaezNAWKHMXGXHWtjnt/MGo4/csM61RySWPAHqMA/TY74uW3aPPTGc AAbWcTlOUpGzO0i7axqsYTWdjabheBfwXK3oJvwrrlumL7j1Oc4oc/UrNAFPphJxfXlEFMNul iYgbe2K8SG0hoLqUCmwUC8WLgbf4d9uskXmUXylCcwxy8uK29tY7wYb+o6IaKq4K596GoDRbd Qlm2tyxlshG50wIqkNGQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 13, 2019 at 2:17 PM Arnd Bergmann wrote: > > On Thu, Dec 12, 2019 at 9:50 PM Linus Torvalds > wrote: > I'll have my randconfig builder look for instances, so far I found one, > see below. My feeling is that it would be better to enforce at least > the size being a 1/2/4/8, to avoid cases where someone thinks > the access is atomic, but it falls back on a memcpy. > > Arnd > > diff --git a/drivers/xen/time.c b/drivers/xen/time.c > index 0968859c29d0..adb492c0aa34 100644 > --- a/drivers/xen/time.c > +++ b/drivers/xen/time.c > @@ -64,7 +64,7 @@ static void xen_get_runstate_snapshot_cpu_delta( > do { > state_time = get64(&state->state_entry_time); > rmb(); /* Hypervisor might update data. */ > - *res = READ_ONCE(*state); > + memcpy(res, state, sizeof(*res)); > rmb(); /* Hypervisor might update data. */ > } while (get64(&state->state_entry_time) != state_time || > (state_time & XEN_RUNSTATE_UPDATE)); A few hundred randconfig (x86, arm32 and arm64) builds later I still only found one other instance: diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index eddae4688862..1c1f33447e96 100644 --- a/net/xdp/xsk_queue.h +++ b/net/xdp/xsk_queue.h @@ -304,7 +304,9 @@ static inline struct xdp_desc *xskq_validate_desc(struct xsk_queue *q, struct xdp_rxtx_ring *ring = (struct xdp_rxtx_ring *)q->ring; unsigned int idx = q->cons_tail & q->ring_mask; - *desc = READ_ONCE(ring->desc[idx]); + barrier(); + memcpy(desc, &ring->desc[idx], sizeof(*desc)); + barrier(); if (xskq_is_valid_desc(q, desc, umem)) return desc; Arnd