Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2829110ybx; Fri, 8 Nov 2019 09:54:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxt6kQ5TqG6KBo/83LtgfVjE0XAODXd57Hd7v60lGsU9h4MR0qE1+mGSfxWBJ9YNslFnOww X-Received: by 2002:aa7:cf97:: with SMTP id z23mr11787108edx.245.1573235647601; Fri, 08 Nov 2019 09:54:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573235647; cv=none; d=google.com; s=arc-20160816; b=xhPRca5H4kimR9Z7HRMsaVF7jz0tO6yf8hfbP0BJreRQzeNiemXEpFwOSDLdQ0XzTd OJ/o/oc2R9bcNfJbAg7mgo5bMdGTAS3b3uTdy6oE48x7xoCg9t+lExsthdYaNQG3ePJ5 gvxgNqNRWen7JuA3RA5HP3f/66ncEHhoqVQaMjrZ+MIzQALVaNN/6auHvRSWfJnWcvmm 57lClPyTfpuaFHK9Vh5lIy5hL8zHmKsmNrF3pWHn7Y1Neb9q0b6UK4Ebgg00aiRnpSlU RKEmXooacXopwpdFfDMy1B3iGrQUTp0atvd17fV8WRt6IGAx5QWbrD2mqltsh72Ny16U 4JvA== 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:dkim-signature; bh=C9TsgJFTcfRwuc/WaCy1JpAsWZBRp62dC/cBlD5yCig=; b=xFhI/DO17lmS1TwbTkAYZzTx7bNVYt3ZUdfOAzuiRNJj3KTv6GLZq3Q+31K3AucJHe 1gRPDul1I6BZFDV2XGAH9ihdEOLnNVAl04tUKgplB/+DWKRsiikZ6lnPrgd2ZZR+QKcQ 6gY4NiIPQCL06YmqO27ICy5A/jepSLCEAUZ6QSwpig/fdn6z03FjijQOpYk/8nbX8a0y 3IbQj+SH44HOZo1Xnql6cYaMz4fnShU84BS6t1K1lfmr7sF4NdVS/qQfiw/x6jDiCKAH x1slRiN7+ft9dUs6lQ+N8bULHrbrc46BMCVN1pNaIQ070aJD4O4RsOkjmNU9bL15W4C5 IaWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M5diUmqr; 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 q23si5398404eda.167.2019.11.08.09.53.44; Fri, 08 Nov 2019 09:54:07 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=M5diUmqr; 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 S1729151AbfKHRxO (ORCPT + 99 others); Fri, 8 Nov 2019 12:53:14 -0500 Received: from mail-il1-f178.google.com ([209.85.166.178]:45056 "EHLO mail-il1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfKHRxO (ORCPT ); Fri, 8 Nov 2019 12:53:14 -0500 Received: by mail-il1-f178.google.com with SMTP id o18so5863543ils.12 for ; Fri, 08 Nov 2019 09:53:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C9TsgJFTcfRwuc/WaCy1JpAsWZBRp62dC/cBlD5yCig=; b=M5diUmqrAoGpBQVNj/NZt0ynuDchzXatuHboKTn50HBE6KCQLAak+nVQyXaOcAKnX7 Wc9plUO/jgMHq/HcqyCxMp55R3K2npPvE+D7TO/cglkFENINKLtlyLtvmiSXw5urmJhS Fe01qGaMgW/rpcJ5KiYaidLJ+9C4BrEC2ym59dRxNTs1wboR7Q6zVcSxAUO78StZZTTM Da7CqjNYfmBGkdRZJaAkMD1HQAv6AUd034rP+3d+Gzw3BI3JyZT0LJh1RFnm2Fzpm6EI lWF2LmmJcs5o+6FmBTU9aNQ1FDI+PtwXi+rBh+bi1hpdAjh3uXDfyriYO8eDt4kbg1d/ 5jHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C9TsgJFTcfRwuc/WaCy1JpAsWZBRp62dC/cBlD5yCig=; b=qsgrvUtQ02j/d+t1FYFWpP11UhHjTF7bI2kyfLVBmvOjGSz+i2ePB3iNAZd+HHSDR1 V/xEB7OlCtTYhUtILQAJ/PerhxyMdIAaRfn2tJ7MO3LI/8kdtE1s9qRgrjuGRf+C6W4J Zzof/ZGusyg2gv06z16JY+DTUHPueucacdTsqc7qV2SWqLGVKOKrW5a9auXGjrBl0+s8 9CAEF/+PxgahdxghvJIfOvoHL8Ogy5/37Xzt/1Sgvhl5pla3+RhO4b8fS6RKyQfm7rAU WmgA7yItVW6zSqym2C+tG0ImpuDUxU8BSYm2UZ1HFvYF9nmxo0fadQAkgvJcss6rPTIl LpWA== X-Gm-Message-State: APjAAAVZ4WkViuyw/LNybHoH3yQj+9EMlw/TcSoWFfrkHEHlvKGwUnI8 7SCjC2OHNs0FHnt/kc3oyRo7aLRIYJT9X8NycRV6oQ== X-Received: by 2002:a92:ca8d:: with SMTP id t13mr13502229ilo.58.1573235592625; Fri, 08 Nov 2019 09:53:12 -0800 (PST) MIME-Version: 1.0 References: <000000000000c422a80596d595ee@google.com> <6bddae34-93df-6820-0390-ac18dcbf0927@gmail.com> In-Reply-To: From: Eric Dumazet Date: Fri, 8 Nov 2019 09:53:01 -0800 Message-ID: Subject: Re: KCSAN: data-race in __alloc_file / __alloc_file To: Linus Torvalds Cc: Eric Dumazet , syzbot , Marco Elver , linux-fsdevel , Linux Kernel Mailing List , syzkaller-bugs , Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 8, 2019 at 9:39 AM Linus Torvalds wrote: > I'd hope that there is some way to mark the cases we know about where > we just have a flag. I'm not sure what KCSAN uses right now - is it > just the "volatile" that makes KCSAN ignore it, or are there other > ways to do it? I dunno, Marco will comment on this. I personally like WRITE_ONCE() since it adds zero overhead on generated code, and is the facto accessor we used for many years (before KCSAN was conceived) > > "volatile" has huge problems with code generation for gcc. It would > probably be fine for "not_rcu" in this case, but I'd like to avoid it > in general otherwise, which is why I wonder if there are other > options. > > But worst comes to worst, I'd be ok with a WRITE_ONCE() and a comment > about why (and the reason being KCSAN, not the questionable > optimization). Ok for a single WRITE_ONCE() with a comment. Hmm, which questionable optimization are you referring to?