From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 138A1C43387 for ; Wed, 16 Jan 2019 10:43:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DCDB720657 for ; Wed, 16 Jan 2019 10:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392116AbfAPKnK (ORCPT ); Wed, 16 Jan 2019 05:43:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:46380 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389215AbfAPKnK (ORCPT ); Wed, 16 Jan 2019 05:43:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E6A35AF66; Wed, 16 Jan 2019 10:43:08 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 579DA1E1580; Wed, 16 Jan 2019 11:43:08 +0100 (CET) Date: Wed, 16 Jan 2019 11:43:08 +0100 From: Jan Kara To: Dmitry Vyukov Cc: Tetsuo Handa , Jan Kara , Al Viro , linux-fsdevel Subject: Re: [PATCH] fs: ratelimit __find_get_block_slow() failure message. Message-ID: <20190116104308.GC26069@quack2.suse.cz> References: <1547201433-10231-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <04c6d87c-fc26-b994-3b34-947414984abe@i-love.sakura.ne.jp> <54b68f21-c8b5-7074-74e0-06e3d7ee4003@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed 16-01-19 10:47:56, Dmitry Vyukov wrote: > On Fri, Jan 11, 2019 at 1:46 PM Tetsuo Handa > wrote: > > > > On 2019/01/11 19:48, Dmitry Vyukov wrote: > > >> How did you arrive to the conclusion that it is harmless? > > >> There is only one relevant standard covering this, which is the C > > >> language standard, and it is very clear on this -- this has Undefined > > >> Behavior, that is the same as, for example, reading/writing random > > >> pointers. > > >> > > >> Check out this on how any race that you might think is benign can be > > >> badly miscompiled and lead to arbitrary program behavior: > > >> https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong > > > > > > Also there is no other practical definition of data race for automatic > > > data race detectors than: two conflicting non-atomic concurrent > > > accesses. Which this code is. Which means that if we continue writing > > > such code we are not getting data race detection and don't detect > > > thousands of races in kernel code that one may consider more harmful > > > than this one the easy way. And instead will spent large amounts of > > > time to fix some of then the hard way, and leave the rest as just too > > > hard to debug so let the kernel continue crashing from time to time (I > > > believe a portion of currently open syzbot bugs that developers just > > > left as "I don't see how this can happen" are due to such races). > > > > > > > I still cannot catch. Read/write of sizeof(long) bytes at naturally > > aligned address is atomic, isn't it? > > Nobody guarantees this. According to C non-atomic conflicting > reads/writes of sizeof(long) cause undefined behavior of the whole > program. Yes, but to be fair the kernel has always relied on long accesses to be atomic pretty heavily so that it is now de-facto standard for the kernel AFAICT. I understand this makes life for static checkers hard but such is reality. But in this particular case I agree with you that special logic is not really warranted. Honza -- Jan Kara SUSE Labs, CR