Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1040491ybc; Tue, 12 Nov 2019 13:16:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxwEsv3A4XYQ09Hjb2oQs3pDgmqmFRbIWoWpSbo6PeCuXca1qZP8laylMIvAtle9fXwBiCX X-Received: by 2002:a50:8e43:: with SMTP id 3mr34830382edx.217.1573593375280; Tue, 12 Nov 2019 13:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573593375; cv=none; d=google.com; s=arc-20160816; b=gHHpzlQhGbz1wAJeB8Z9RxUS8FWq5E3WwgYdFFcOKKqHi09+QaOVxn7Y7PjQhGhXAq irjlKNswsmaF8YzplsZDlDTvBYF15Z40clvpuAKVJsLpVDAQ0x3kwRfr6q89ayI0dPmn uE1lR9XQ80M3Rb5S2AnGh7WMxe5DtqF7QrHv2AeMlyVGAmLclvTZXnKlVaImM1kBltXc jLD23mQKHCG7BIhBU8de4YSku4WgOeyJI89LvLIJzTwMb3uvfNYTw2pYJCNJ1Z5iwKvc rFn7iVX0bunh4OXhu1eqQx0kf+92741nAOmj2wd2Hs6h4rYgBWNdtaFWEmrFAoWxBlDw vyGw== 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=P9XIZS7SU3RS49LRENl5SM7lOZ7kZM4P3ixT/QNzhdE=; b=BFAZTIl5MN3cMfHDgjTKnz0lP2rUoNVupHS2MucaVvB3OnRK564gUcg8tajcyjpJ1C Ys+m/kWSQJh1HxxqUSJ98A5n04WFgaVZPOje1RvzfD8DLxx+7g1G2kJ7MYyIVQjHg1i3 MvKaxPfIgwn/8TsTJNfIhWAgr8wJw6QV4+FAaEB/Y+M/z/UGPFLx1cuI96mlMUMP2tSI 2YrBh0zc2Qok08Xj4yiRowZ8UcDAjJD4jFnrcUjZiUvn4lCUA+tPfa63Gf75edSm7xKR 70pEW48ctBTlR09f+0QUS5L8ouK5d7C7QdQ2uLlNbjJIT8DB+jFCdF/YNHl3lPnI8hYY 3vew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=UwY9cZA3; 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 g6si14439807eda.377.2019.11.12.13.15.32; Tue, 12 Nov 2019 13:16:15 -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=@linux-foundation.org header.s=google header.b=UwY9cZA3; 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 S1727530AbfKLVOD (ORCPT + 99 others); Tue, 12 Nov 2019 16:14:03 -0500 Received: from mail-lj1-f179.google.com ([209.85.208.179]:36564 "EHLO mail-lj1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727542AbfKLVN6 (ORCPT ); Tue, 12 Nov 2019 16:13:58 -0500 Received: by mail-lj1-f179.google.com with SMTP id k15so59951lja.3 for ; Tue, 12 Nov 2019 13:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P9XIZS7SU3RS49LRENl5SM7lOZ7kZM4P3ixT/QNzhdE=; b=UwY9cZA3V5T0vyNv2V661JB/VTL10yx6gFYc1xtgKQgONfocJfi8ojlq33WVjM/r+L cwAON8sR7dBpJMPq9/fq/cuIi8qLzAUszVs0iJ7LDN8D1o4e199T+fOpPSZOiTetQnuj Y+nhBGmk1z4MO+7U+QjWjCyy2lbljWp+V5Ag8= 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=P9XIZS7SU3RS49LRENl5SM7lOZ7kZM4P3ixT/QNzhdE=; b=ereqeFUnITbU36JiZzbppJI+G5C9CYwglfeAxCUf8Vrcsy9UewU0HNLZbPrrnkYF6I CyaVF7k42BRImZUrQOGMGireYE9CSZeSuSlVXXcbTdyJJfepGzBe082OKl+POjffMwrO w8xsZwVbubR5ZNn1zW5KLQpGSyw1xvkUKL6y+h6UyN2Og1XONhd5+VEg4E4f5rpkkBwh j/NZ6T2niDgY200oVWwkCj1VtkUWtVc5yj4Vp9ecaEvEh7hAA3b0zKS1pFPHN5Eoatxa L6xvEAwK8cPyq6+ToDKDZaYzbbUgFEjlq6e+Z2aEKzEQ0eOaVHV/27Wy2X4PBxEJklFy aWug== X-Gm-Message-State: APjAAAXQg6x1e51/0EKWLQOC5zdGZBGL1kY5x7Z8E81c0d7BYz0WaEHk VTdcQDgL0EWef/SzfwoyotDU4Q9C2vo= X-Received: by 2002:a2e:9dd5:: with SMTP id x21mr21593132ljj.232.1573593235300; Tue, 12 Nov 2019 13:13:55 -0800 (PST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id g23sm11525202ljn.63.2019.11.12.13.13.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2019 13:13:52 -0800 (PST) Received: by mail-lj1-f171.google.com with SMTP id y23so21624ljh.10 for ; Tue, 12 Nov 2019 13:13:52 -0800 (PST) X-Received: by 2002:a2e:22c1:: with SMTP id i184mr21906891lji.1.1573593232214; Tue, 12 Nov 2019 13:13:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Tue, 12 Nov 2019 13:13:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: KCSAN: data-race in __alloc_file / __alloc_file To: Alan Stern Cc: Marco Elver , Eric Dumazet , Eric Dumazet , syzbot , linux-fsdevel , Linux Kernel Mailing List , syzkaller-bugs , Al Viro , Andrea Parri , "Paul E. McKenney" , LKMM Maintainers -- Akira Yokosawa 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 Tue, Nov 12, 2019 at 12:58 PM Linus Torvalds wrote: > > Honestly, my preferred model would have been to just add a comment, > and have the reporting tool know to then just ignore it. So something > like > > + // Benign data-race on min_flt > tsk->min_flt++; > perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); > > for the case that Eric mentioned - the tool would trigger on > "data-race", and the rest of the comment could/should be for humans. > Without making the code uglier, but giving the potential for a nice > leghibl.e explanation instead of a completely illegible "let's > randomly use WRITE_ONCE() here" or something like that. Hmm. Looking at the practicality of this, it actually doesn't look *too* horrible. I note that at least clang already has a "--blacklist" ability. I didn't find a list of complete syntax for that, and it looks like it might be just "whole functions" or "whole source files", but maybe the clang people would be willing to add "file and line ranges" to the blacklists? Then you could generate the blacklist with that trivial grep before you start the build, and -fsanitize=thread would automatically simply not look at those lines. For a simple first case, maybe the rule could be that the comment has to be on the line. A bit less legible for humans, but it could be - tsk->min_flt++; + // Benign race min_flt - statistics only + tsk->min_flt++; // data-race instead. Wouldn't that be a much better annotation than having to add code? Linus