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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 D010BC433E0 for ; Thu, 11 Feb 2021 14:20:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C79464E92 for ; Thu, 11 Feb 2021 14:20:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C79464E92 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 92C136B00F6; Thu, 11 Feb 2021 09:20:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B51D6B00F7; Thu, 11 Feb 2021 09:20:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77C8D6B00F8; Thu, 11 Feb 2021 09:20:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0051.hostedemail.com [216.40.44.51]) by kanga.kvack.org (Postfix) with ESMTP id 5C7DD6B00F6 for ; Thu, 11 Feb 2021 09:20:44 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 207DE180AD801 for ; Thu, 11 Feb 2021 14:20:44 +0000 (UTC) X-FDA: 77806198008.25.2F3E0B5 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf04.hostedemail.com (Postfix) with ESMTP id C7EBB130 for ; Thu, 11 Feb 2021 14:20:42 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613053242; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5Xww8RvxYre9GaHVK6ekS1+0MLJh705ok+8LcldaB5o=; b=rN3S05xS7YtU3Rg6UqPw5SlbZI+AWmIcVh0JmVKvkqLZzI0YyLVfvB8sPv0Og+8cHxG+uD 1qAMd5eWkjWoC28ltY2cnhyCAiAnroZ163yR2yjOUhSefP/UfSBq05sgTOk3z73ngUp7DA oRtsrVbP+NW+rdCm0yGZvFkbmlDsEvw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 306AEB007; Thu, 11 Feb 2021 14:20:42 +0000 (UTC) Date: Thu, 11 Feb 2021 15:20:41 +0100 From: Michal Hocko To: Matthew Wilcox Cc: Jan Kara , Dmitry Vyukov , syzbot , Jan Kara , linux-ext4@vger.kernel.org, LKML , syzkaller-bugs , Theodore Ts'o , Linux-MM Subject: Re: possible deadlock in start_this_handle (2) Message-ID: References: <000000000000563a0205bafb7970@google.com> <20210211104947.GL19070@quack2.suse.cz> <20210211121020.GO19070@quack2.suse.cz> <20210211125717.GH308988@casper.infradead.org> <20210211132533.GI308988@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210211132533.GI308988@casper.infradead.org> X-Stat-Signature: 38ez6tgaxegptu6t14xp8p73krwyk1ot X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C7EBB130 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1613053242-562033 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 11-02-21 13:25:33, Matthew Wilcox wrote: > On Thu, Feb 11, 2021 at 02:07:03PM +0100, Michal Hocko wrote: > > On Thu 11-02-21 12:57:17, Matthew Wilcox wrote: > > > > current->flags should be always manipulated from the user context. But > > > > who knows maybe there is a bug and some interrupt handler is calling it. > > > > This should be easy to catch no? > > > > > > Why would it matter if it were? > > > > I was thinking about a clobbered state because updates to ->flags are > > not atomic because this shouldn't ever be updated concurrently. So maybe > > a racing interrupt could corrupt the flags state? > > I don't think that's possible. Same-CPU races between interrupt and > process context are simpler because the CPU always observes its own writes > in order and the interrupt handler completes "between" two instructions. I have to confess I haven't really thought the scenario through. My idea was to simply add a simple check for an irq context into ->flags setting routine because this should never be done in the first place. Not only for scope gfp flags but any other PF_ flags IIRC. -- Michal Hocko SUSE Labs