Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3962718ybg; Mon, 28 Oct 2019 23:32:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZh0mOiKMD/4OPWPcZYfw9fQkalnstVaFERZ+pQoTRItfTDwuxdZok4mp02lUj0ZowxCYU X-Received: by 2002:aa7:c691:: with SMTP id n17mr12637171edq.100.1572330747887; Mon, 28 Oct 2019 23:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572330747; cv=none; d=google.com; s=arc-20160816; b=WqYXg3TcyynCew1/m5u6RyqUfJ5KICNB6oZbuWmg9vJ9//gyfANZSj4vYNnz505lgx 8tsH7ix7FcOlgzdjjxuM0UGdVu2Mpr+2Jc5UC/eVvzGunF8DThGjWmqjNw6G3ghV4V10 nnr5cFnvMnjh87/+JGoXnDHB8eEjEr5BNHjcP1q1qDjgIyHvdgNg1sKnTXGGbfKHkbxV OCh3yuIHE+NJrGlkZeg8BFvgarzfbsELWw7eqplvtgdORjYbQlvtpDL19BcD4P+UpVXH NAnnek1RaCXfqKBHZ+nHhGKp5y8bWlfu/M6BBH50a8rF3nrikSvRp6S8yn7Yx2ibkBCb 81mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=dLVaJ4QtHyLDwkClszRkjXrmUybX4PHJGPpDC+cI1Nw=; b=Hmbh4vO2P8SkfgJpAUsAcQRuFPd1brrxhbJVDepXPv8lpjSaE0oRGMCFbVpDAgV/Nc WidaTseYI5XfIVt68fha9FYtwRryBF4Pc4GroSRDjDZEDlQK9lLdmdVDznqCQ1cFHgvm 2/QvNHqAZWSmRLyMbUIN/QJjvmQO6+JRDro6/oftk0jRP4yhH58JD/IVnK8IdZ+LE8S5 mvz8+HNjSrnSlGHWYJIyczwO4zDbTYitzIO02XwquPEEb1TuzzC/RR5yBuyNmsCKWRaz w4b2CUOWeN6rWxwShCffe6hJHt1gSITrjnlbGxcBqvVnOxOPHurafiKgggPQLKjXU/7F 9yFw== ARC-Authentication-Results: i=1; mx.google.com; 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 oe20si7645586ejb.228.2019.10.28.23.32.04; Mon, 28 Oct 2019 23:32:27 -0700 (PDT) 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; 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 S2390622AbfJ1RsI (ORCPT + 99 others); Mon, 28 Oct 2019 13:48:08 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:41553 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730715AbfJ1RsH (ORCPT ); Mon, 28 Oct 2019 13:48:07 -0400 Received: from [91.217.168.176] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iP8qe-0005p2-OR; Mon, 28 Oct 2019 17:30:32 +0000 Date: Mon, 28 Oct 2019 18:30:32 +0100 From: Christian Brauner To: Oleg Nesterov Cc: dvyukov@google.com, ebiederm@xmission.com, elver@google.com, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH cgroup/for-5.5] cgroup: remove cgroup_enable_task_cg_lists() optimization Message-ID: <20191028173031.m32p5e3ek764hnre@wittgenstein> References: <0000000000003b1e8005956939f1@google.com> <20191021142111.GB1339@redhat.com> <20191024190351.GD3622521@devbig004.ftw2.facebook.com> <20191025125606.GI3622521@devbig004.ftw2.facebook.com> <20191025133358.pxpzxkhqc3mboi5x@wittgenstein> <20191025141325.GB6020@redhat.com> <20191025143224.wtwkkimqq4644iqq@wittgenstein> <20191025155224.GC6020@redhat.com> <20191025170523.u43rkulrui22ynix@wittgenstein> <20191028164852.GA17900@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191028164852.GA17900@redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 05:48:52PM +0100, Oleg Nesterov wrote: > On 10/25, Christian Brauner wrote: > > > > On Fri, Oct 25, 2019 at 05:52:25PM +0200, Oleg Nesterov wrote: > > > On 10/25, Christian Brauner wrote: > > > > > > > > On Fri, Oct 25, 2019 at 04:13:25PM +0200, Oleg Nesterov wrote: > > > > > Almost every usage of task->flags (load or sore) can be reported as "data race". > > > > > > > > > > Say, you do > > > > > > > > > > if (task->flags & PF_KTHREAD) > > > > > > > > > > while this task does > > > > > > > > > > current->flags |= PF_FREEZER_SKIP; > > > > > schedule(). > > > > > > > > > > this is data race. > > > > > > > > Right, but I thought we agreed on WONTFIX in those scenarios? > > > > The alternative is to READ_ONCE()/WRITE_ONCE() all of these. > > > > > > Well, in my opinion this is WONTFIX, but I won't argue if someone > > > adds _ONCE to all of these. Same for task->state, exit_state, and > > > more. > > > > Well, I honestly think that state and exit_state would make sense. > > Heh. Again, I am not arguing, but... > > OK, lets suppose we blindly add READ_ONCE() to every access of > task->state/exit_state. > > Yes, this won't hurt and possibly can fix some bugs we are not aware of. I wasn't planning or working on adding *_ONCE everywhere. ;) I just think it makes sense as a preemptive strike since they are shared (though mostly protected by locks anyway). > > However, > > > There already were issues that got fixed for example in 3245d6acab98 > > ("exit: fix race between wait_consider_task() and wait_task_zombie()") > > The change above can't fix the problem like this. No argument about the code we discussed right here, for sure! > > It is not that this code lacked READ_ONCE(). I am sure me and others > understood that this code can read ->exit_state more than once, just > nobody noticed that in this case this is really wrong. > > IOW, if we simply change the code before 3245d6acab98 to use READ_ONCE() > the code will be equally wrong, and > > > and as far as I understand this would also help kcsan to better detect > > races. > > this change will simply hide the problem from kcsan. I can't speak to that since the claim that read_once() helps them even if it's not really doing anything. But maybe I misunderstood the k{c,t}san manpage. Christian