Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp656791ybk; Wed, 13 May 2020 09:34:40 -0700 (PDT) X-Google-Smtp-Source: APiQypLzk34YMMt5zCn1vQKpnSlYlf6Twh4WMJZbN7dlydP48Qnf6lDtbQh2+4O8DLxhL7s5W1xc X-Received: by 2002:a17:906:2418:: with SMTP id z24mr22896332eja.42.1589387680518; Wed, 13 May 2020 09:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589387680; cv=none; d=google.com; s=arc-20160816; b=RwE0OFW3IPvqG3JqSim0MxD701MhJkJt0HnJ6bAJ9RGWsw0G3eb8Mo+cgxkYRblmYb iRmwNXXjRCAs9EUCScUGLnCFvdcamS5RNC2HaV3EPE/z/MUGOpnAPJM2Ui546dtsqUgQ nxK+7EkxHX4oF8R0Gju/ZeRdYNd+oTj5sKYBxqBCcfS/3eYfgHjJnZrU4oCq6mN0vPPt L3k63O9YEPy1K8JbKVhK8GkV5vHlrDsjOG2GY60OzFsN+S/4ATmb4Px82EccTMBAimMt jFYnIo6OuTZiaS3BM+6i1qKLxxvrLJEXhKUBksgHV/LWbBGHKDJ6HA1jK6u/rbWdvLL5 GkYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=D3mS4CodYhqWvMOjxBjmdy5pa360a+Akw/T3ORyQ1No=; b=bUX1I0hV9b54wagk3B9XFM+fkQGtcFuNY7XuU8PEZ74K5dlnKPpAcWIrE3Nirg6xMx 5lQtNJUpmM29f+IVaLSq8SfurRokhltmLEoUB7zRJvPMOLtemIkQmqC/4vR3vQ3mhYiW dJ7r0A+nwOSyAlRdDQnpnZ3Vplo8ACOKxQrx+s0w1jJDgu/saW/yzi0RrzM7T5TMEWAY 0nv5BQDK8BBLm7dudb2djR3/j3dc99nbizZyrfiXc8IwR+r7PgTBPitIoZ7KPhPy0SxJ p9+irXCWPNpQZRlBpQLVvPaRXdIOaKZyX0IM3y14vdz69vsTkK6z5CaAbBNAoXKfPHw4 GxlQ== 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 b10si83112ejd.323.2020.05.13.09.34.15; Wed, 13 May 2020 09:34:40 -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 S1732218AbgEMQci (ORCPT + 99 others); Wed, 13 May 2020 12:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728780AbgEMQch (ORCPT ); Wed, 13 May 2020 12:32:37 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F507C061A0C for ; Wed, 13 May 2020 09:32:37 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jYuJ6-0000T1-Nj; Wed, 13 May 2020 18:32:32 +0200 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 0D399100605; Wed, 13 May 2020 18:32:32 +0200 (CEST) From: Thomas Gleixner To: David Laight , 'Will Deacon' , Peter Zijlstra Cc: Marco Elver , LKML , "Paul E. McKenney" , Ingo Molnar , Dmitry Vyukov Subject: RE: [PATCH v5 00/18] Rework READ_ONCE() to improve codegen In-Reply-To: <9ba9552bd68a4461bb346dc3bae71d7a@AcuMS.aculab.com> References: <20200511204150.27858-1-will@kernel.org> <20200512081826.GE2978@hirez.programming.kicks-ass.net> <20200512190755.GL2957@hirez.programming.kicks-ass.net> <20200513111057.GN2957@hirez.programming.kicks-ass.net> <20200513123243.GO2957@hirez.programming.kicks-ass.net> <20200513124021.GB20278@willie-the-truck> <9ba9552bd68a4461bb346dc3bae71d7a@AcuMS.aculab.com> Date: Wed, 13 May 2020 18:32:32 +0200 Message-ID: <87wo5f23tr.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Laight writes: > From: Will Deacon >> Sent: 13 May 2020 13:40 >> On Wed, May 13, 2020 at 02:32:43PM +0200, Peter Zijlstra wrote: >> > On Wed, May 13, 2020 at 01:48:41PM +0200, Marco Elver wrote: >> > >> > > Disabling most instrumentation for arch/x86 is reasonable. Also fine >> > > with the __READ_ONCE/__WRITE_ONCE changes (your improved >> > > compiler-friendlier version). >> > > >> > > We likely can't have both: still instrument __READ_ONCE/__WRITE_ONCE >> > > (as Will suggested) *and* avoid double-instrumentation in arch_atomic. >> > > If most use-cases of __READ_ONCE/__WRITE_ONCE are likely to use >> > > data_race() or KCSAN_SANITIZE := n anyway, I'd say it's reasonable for >> > > now. >> >> I agree that Peter's patch is the right thing to do for now. I was hoping we >> could instrument __{READ,WRITE}_ONCE(), but that we before I realised that >> __no_sanitize_or_inline doesn't seem to do anything. > > Could something be done that put the addresses of the instructions > into a separate segment and have KASAN check that table before > reporting an actual error? That still does not solve the problem that the compiler adds calls into k*san which we need to prevent in the first place. Thanks, tglx