Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp802107ybb; Wed, 8 Apr 2020 10:08:31 -0700 (PDT) X-Google-Smtp-Source: APiQypKvWCIzdwVu8KZ2TcoyPCLw/BbvOPmGx5uDx/H6j5jqWmksunTY2d+bMJ2jIh6T/0ZFyvpk X-Received: by 2002:aca:62d5:: with SMTP id w204mr550048oib.119.1586365711637; Wed, 08 Apr 2020 10:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586365711; cv=none; d=google.com; s=arc-20160816; b=YZTuXdoZO+zumLLIfo5L8Y1OajXbCvy9SGo5NUPg2jT+y3jcBl5c1uiNVzkGLFPxKO kWIV8ZypWWQqCN5XQdo6XVJXv7CDTpPrqciHQ1H7uC/U/aaoNyOIcUPtKIZgEGddxhlu eRgovUYdU5JFrInSuxxvSxjmx9mIgcGeRjROmTZetVArVJMyHhiJPX2OVJ5VVeiohIdg PK5/s1lE1ApRwQYbfHvAhMf66UuDPEOqtitlMVScKf38zJPmHwqvy4gbng10VMaLCJ5l 2iGHJEGteXfsqcRsb3AocitjCojb7zVRaqEea61dcc10LcDQcuMJqmFc4AzLoxRtF22Y YBUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=FaARG6XZkrL693jomz9D6POM95NcKN5ZYfjmCHYqtH8=; b=GqF288D2IzLYPRqhCkR4BiYLU4Qd59IaSionpDk1TM/iELrIvD5VOSiEtyvhJxvajq wQkYoykOhtBs76xi4xP4KFuZSm9PZ5c12vvgPHl0P7FJu7NYjFj0o8lMACgeBCMnqLGO 47amgfWs8twUh4yo5r3dB5vzp5x90qF9cBhF4PCf8xf8D7mIEnXdxX/Op4/ewUPTdZ4+ vhMPm2xPOsAMfstwzusiYafSxCG80FrU+d/5iYbo+97ioWHPkXHGRBQPAejTMak7ldOq sFyaehpUYaNWAsXyfn2zNvFbkuQuv9d6HksjinazAfSGEEyWpUQiHk2d3ZP/xB1LJZus OjqQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v137si2107700oif.170.2020.04.08.10.08.17; Wed, 08 Apr 2020 10:08:31 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbgDHP0m (ORCPT + 99 others); Wed, 8 Apr 2020 11:26:42 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37272 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727192AbgDHP0m (ORCPT ); Wed, 8 Apr 2020 11:26:42 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so334679wml.2 for ; Wed, 08 Apr 2020 08:26:40 -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=nkzj3ggpZ0/jeCgFKgVRQyxOYM2dxyOerjmOsOmfFHIHXY2DKRS1KBARRjTOMQpVL6 2hAzdFMiHaxGd0HJJc4tvKyDvffHC9mlBWhOrrcV18ZPnTU5uuuWIJjjubK365YPIwn6 pPD+2aCcN3XVLmCM88WuuzICX+W//oP528t5vN66jNO4mML6F+DzZ/mgyE9tUgcCHxok 5S5aOSW3nc59gGlrn5CVrqmFgzWSUFMDPkKWwRYs1szyZBRnbBAyUq7UY6yPzRJYxmqu 9iC3K0U5tt0s6PCfWuUzw0qFKT+oyfuh22IOfB3C0TwkzkHlJ7iKZ9NEZXcP/gCzpWnj 18xw== X-Gm-Message-State: AGi0PuaHVoUmnTEtiZEAz54KoPbMgpuiBphMT1SMmWBX9Hc8AkYJT4r6 7CTTkSvb22dWwJkZC3hLW7sw9YaL 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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