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=-1.0 required=3.0 tests=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 AE483C2D0EA for ; Wed, 8 Apr 2020 15:26:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 78206206C0 for ; Wed, 8 Apr 2020 15:26:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78206206C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 26AE68E000D; Wed, 8 Apr 2020 11:26:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 21CF98E0006; Wed, 8 Apr 2020 11:26:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 132F98E000D; Wed, 8 Apr 2020 11:26:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id EF9248E0006 for ; Wed, 8 Apr 2020 11:26:41 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B16A7A8C2 for ; Wed, 8 Apr 2020 15:26:41 +0000 (UTC) X-FDA: 76685065002.08.town25_5787248afb818 X-HE-Tag: town25_5787248afb818 X-Filterd-Recvd-Size: 4354 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 8 Apr 2020 15:26:41 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id t203so301174wmt.2 for ; Wed, 08 Apr 2020 08:26:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FaARG6XZkrL693jomz9D6POM95NcKN5ZYfjmCHYqtH8=; b=OV6TJ/Ph2I/zG1U0hf/cY1i03ojxQUFgKWqLbUWXCXaUXq2f1diw2OLiaH7SgeDxLk pcCPSKrti1bgmlBvMd9QJScalDfXMAfUAUEm7tGPQ2ep3GF3GEiaRwE/QHd9AY4nJaOc 7kMxd3iQ3KkPx5SGIfjG1RRHegkDkBbK+ea6WUi8+HFhQ0Q871X9RrRJC8XXcry42zNy 5wOcYSgSEQSSGErnkkHI8zFFmRLhS+mZAXdZvf5HBxUe2XefNOU8XehwFABtX/F+VYpl 9OpxF8x6D4MV4e7sRYkLrJGvJ1Zi5n03W2x12Ks18Xsy4gQnA79oCAnO6QLB0cS8OiI8 EM3Q== X-Gm-Message-State: AGi0PuYMxrVlv1MNNlMoYl8JktyRVLOAQzmWptqbcr/ZxcXwVjgEcKYJ OgQLWhVRXkfq1ztAM2Ms5neW0ceH X-Google-Smtp-Source: APiQypLbvH8t4KrmuhPNvl2VlWY6JHSFAytcIzG4bMsvc7U2Aw/qM+mYKQPaFxmiYumDG/IYgux5Vw== X-Received: by 2002:a1c:e203:: with SMTP id z3mr5374024wmg.71.1586359594251; Wed, 08 Apr 2020 08:26:34 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id p7sm3142652wrf.31.2020.04.08.08.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2020 08:26:32 -0700 (PDT) Date: Wed, 8 Apr 2020 17:26:30 +0200 From: Michal Hocko To: Peter Xu Cc: linux-kernel@vger.kernel.org, Linus Torvalds , linux-mm@kvack.org, Andrew Morton , syzbot+693dc11fcb53120b5559@syzkaller.appspotmail.com Subject: Re: [PATCH 1/2] mm/mempolicy: Allow lookup_node() to handle fatal signal Message-ID: <20200408152630.GA18914@dhcp22.suse.cz> References: <20200408014010.80428-1-peterx@redhat.com> <20200408014010.80428-2-peterx@redhat.com> <20200408102128.GX18914@dhcp22.suse.cz> <20200408142039.GD66033@xz-x1> <20200408143024.GZ18914@dhcp22.suse.cz> <20200408152435.GH66033@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200408152435.GH66033@xz-x1> 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 Wed 08-04-20 11:24:35, Peter Xu wrote: > On Wed, Apr 08, 2020 at 04:30:24PM +0200, Michal Hocko wrote: > > On Wed 08-04-20 10:20:39, Peter Xu wrote: > > > On Wed, Apr 08, 2020 at 12:21:28PM +0200, Michal Hocko wrote: > > > > On Tue 07-04-20 21:40:09, Peter Xu wrote: > > > > > lookup_node() uses gup to pin the page and get node information. It > > > > > checks against ret>=0 assuming the page will be filled in. However > > > > > it's also possible that gup will return zero, for example, when the > > > > > thread is quickly killed with a fatal signal. Teach lookup_node() to > > > > > gracefully return an error -EFAULT if it happens. > > > > > > > > > > Meanwhile, initialize "page" to NULL to avoid potential risk of > > > > > exploiting the pointer. > > > > > > > > > > Reported-by: syzbot+693dc11fcb53120b5559@syzkaller.appspotmail.com > > > > > Fixes: 4426e945df58 ("mm/gup: allow VM_FAULT_RETRY for multiple times") > > > > > > > > I am not familiar with thic commit but shouldn't gup return ERESTARTSYS > > > > on a fatal signal? > > > > > > Hi, Michal, > > > > > > I do see quite a few usages on -ERESTARTSYS, but also some others, > > > majorly -EINTR, or even -EFAULT. I think it could be a more general > > > question rather than a specific question to this patch only. > > > > I am sorry but I was probably not clear enough. I was mostly worried > > that gup doesn't return ERESTARTSYS or EINTR when it backed off because > > of fatal signal pending. Your patch is checking for 0 an indicating that > > this is that condition. > > Yeah I just noticed the fact, sorry! > > Hillf just posted a fix there for recovering the behavior: > > https://lore.kernel.org/lkml/20200408151213.GE66033@xz-x1/ yeah, that is the proper fix. -- Michal Hocko SUSE Labs