Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6488961ybx; Mon, 11 Nov 2019 09:57:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxXx3rmmQ5ePGorfLaXFD7U3yP1Vkly4EPG+v6MA+SVLo9q99A9ihdEUazReGIxkOPyNErx X-Received: by 2002:a50:ff12:: with SMTP id a18mr27384586edu.200.1573495022326; Mon, 11 Nov 2019 09:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573495022; cv=none; d=google.com; s=arc-20160816; b=DkypnAO337rzBEnbBH3aohZR4ekZ1qH+mhJJcNmQ+kC0PrprC9MzeDQiwm2jaxGA5/ fdd/9XMjfON+NjjPgbg9qfGzpo6hTGLvq6/oGPTjHYLo41O3bcTmF64FgXoal6t1GOFm uMJnZfX2fk/L4S9Uwub5pQzsWwIRCKxOifEnjFrnHP6b4KSFDWrKyWY7Jb5jWEfoznzw 3mdEHCKIWn0aJNbYPU6kWKEF5hpF3i1Zb6Ya+EK7Qy8Jdbj8TCC6nlDb8eIFW7G+7BlM JJJ+wZnoUpKc/8bAPKiIb58bx8M36/geV1N3OA+mm0pzRARr06Ba+eMqmjbCQcm9ls4i iofg== 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=xxpQr+dia9IqKsQkLC2r2q0hxYEWq0JKYn0HyGqco2A=; b=p0mcPWfxRAWD7veGxPCIs2VFhlEvgvRmcKMwxJBi42xVClvZJLm8ncUNcFySw7pPsV 3Akztb66GQlKSEKxN2aVcs0/DLJhIsX1B0a/MbAFYj12gZMxIc2XYFGLH7KdVcZeRSXg s2X9QTEqRJTr8/xoPFxJQcgnzGewxaW0jXQiNxP2vnOqPLP9yAKr9RtVTOCB1WV3KY9r VGS+niWlVQfCxZe9huk+8ELdVnvJkNAyY/v6oBDvlFW6rog2sL6koNC+bzPnkEaTJg76 F6Upg7XwXMCK6JBc55fhEAowZ1n8GpdP0z5KZk7M8+Vpt9z/xzCIDyOBOpfqoc/XgrRo mKrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Qn6WJ4jP; 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 19si11135358edz.85.2019.11.11.09.56.37; Mon, 11 Nov 2019 09:57:02 -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=Qn6WJ4jP; 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 S1726989AbfKKRwz (ORCPT + 99 others); Mon, 11 Nov 2019 12:52:55 -0500 Received: from mail-il1-f170.google.com ([209.85.166.170]:35160 "EHLO mail-il1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbfKKRwz (ORCPT ); Mon, 11 Nov 2019 12:52:55 -0500 Received: by mail-il1-f170.google.com with SMTP id z12so12892540ilp.2 for ; Mon, 11 Nov 2019 09:52:54 -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=xxpQr+dia9IqKsQkLC2r2q0hxYEWq0JKYn0HyGqco2A=; b=Qn6WJ4jP6os+r/cocp+3Nn/6ERvGDTCL2cYO2coyzwnsqVszKRHYejKFAGmAONNudS UX/f/QXWhV9H5NNrMbP9IJJ27BAw03fQjE7nzELH/zFzpDiD7MIvjlQPYF5mvOiliSRf N68/rNZ3zUOwf4QIPQcl5SuWLe2/3/AJdtBQIA5ltKxAHdTXTWudwHsO6B50PMEslWTG z4UgMtSNJQ8SI3Ae3aA6TuwKgvDhfRhG2HHpdZn+YUkig33GV+USvCGQnLEuelgRXSSR CDUt3P36Iwu7ztcsMl+fodD5Gy97y+H6C8XgCQSe9/8BuozNct3mu3tdlyMr+oa/cUks TYuA== 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=xxpQr+dia9IqKsQkLC2r2q0hxYEWq0JKYn0HyGqco2A=; b=JMI561XCdk/ZkjOJZxQHiUp6djYFW/eWNl9b5xcWA3B4VIso/7kycv+yksNyvGzuhs OaOVK5vZyHeLaFbT1/LQxUR1fcshp3T7RHghQGN2SXt0TQyjvGPX8B2WTZrWBiJgWJAS qfb49oatxL3cfFmY8QkDcPquEGzqQF7kC7D1BJSO+QvWFgKiQGe1MrLXWhJOJYuli0RN JkRuODrVHIhGja8Egn+zoypGSHdJavawq6RA8O+bey+qH1k3mX8/09SAyrKMW8ecuy+d U9/NAKHyF8wIkzw/5CofOYH06X3jlyV7cFyS21utAxE07ml7UHkf8LMjqsH0h824Pzaf GyoQ== X-Gm-Message-State: APjAAAXxbBVMyJQK21RNunbfLVbkyOCj8cQiQumXNXwI6wzhcUiGxlEX fc9vIj30Bpi8ELRRs0HobwdMCLTkKPZPQ1vv2zetlw== X-Received: by 2002:a92:ca8d:: with SMTP id t13mr30027628ilo.58.1573494773987; Mon, 11 Nov 2019 09:52:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Eric Dumazet Date: Mon, 11 Nov 2019 09:52:41 -0800 Message-ID: Subject: Re: KCSAN: data-race in __alloc_file / __alloc_file To: Linus Torvalds Cc: Alan Stern , Marco Elver , 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 Mon, Nov 11, 2019 at 8:51 AM Linus Torvalds wrote: > > On Mon, Nov 11, 2019 at 7:51 AM Alan Stern wrote: > > > > I dislike the explicit annotation approach, because it shifts the > > burden of proving correctness from the automatic verifier to the > > programmer. > > Yes. > > However, sometimes explicit annotations are very useful as > documentation and as showing of intent even if they might not change > behavior or code generation. > > But they generally should never _replace_ checking - in fact, the > annotations themselves should hopefully be checked for correctness > too. > > So a good annotation would implicitly document intent, but it should > also be something that we can check being true, so that we also have > the check that reality actually _matches_ the intent too. Because > misleading and wrong documentation is worse than no documentation at > all. > > Side note: an example of a dangerous annotation is the one that Eric > pointed out, where a 64-bit read in percpu_counter_read_positive() > could be changed to READ_ONCE(), and we would compile it cleanly, but > on 32-bit it wouldn't actually be atomic. > > We at one time tried to actually verify that READ/WRITE_ONCE() was > done only on types that could actually be accessed atomically (always > ignoring alpha because the pain is not worth it), but it showed too > many problems. > > So now we silently accept things that aren't actually atomic. We do > access them "once" in the sense that we don't allow the compiler to > reload it, but it's not "once" in the LKMM sense of one single value. > > That's ok for some cases. But it's actually a horrid horrid thing from > a documentation standpoint, and I hate it, and it's dangerous. > > Linus I was hoping to cleanup the 'easy cases' before looking at more serious issues. But it looks like even the ' easy cases' are not that easy. Now I wonder what to do with the ~400 KCSAN reports sitting in pre-moderation queue.