Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp766693ybb; Wed, 8 Apr 2020 09:28:49 -0700 (PDT) X-Google-Smtp-Source: APiQypL6DqcuLLaohBdpls/BxmmrF6rbbJT80f685LVzcWO0WvOTRYLXpyOTZb2fO51GIOsh/TQZ X-Received: by 2002:aca:af97:: with SMTP id y145mr2994161oie.24.1586363329445; Wed, 08 Apr 2020 09:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586363329; cv=none; d=google.com; s=arc-20160816; b=mKLXIbQjfQgEepAXLayVUw4QUZV7u3IljMQohYtk9b0pAej48eBKX+aEqXuzYjnQAO 7Ese1xdNU3QbNwQWuThdSsxs4R13KXd2EoimaJKH8lwOsP9aglWm4CHS8MFsU0figgvO xQtTQVHjANdiUiIB67EoKKOJSWxr5K179FuVxSZ2v9TbJf6HELI5kndrkrPK2L4CfboH TtCDrvkN6EMHVjWZwMuJdozfWSA/WOqRiSJCYvizC8aZ+1v3dRld7oSlBPqkFYbDcjnX gVCeUgNqF3AvxGiWhJydGfOCVwXKaWiDikUX9dXIaO5PQaE9GXCy5LuS8mhuNa4MmllV mTjg== 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 :dkim-signature; bh=jInxb6S6kno8alLpBOp6oo5DZLTgW5u7AbwcRZ4qu+U=; b=Wc5owXkkb3zIhHX5sVLroRzh38tXOWViWZlD8rZ/7yAqxs43ZBGMM3/h86x7Lxea0w gHK5PWfYtEezvL0USLsuquusMDUPqeS0ODzBkgqdI4entmm7tOkxfayniKEOzB6Gz66j f1skW5O2XDs8rMxlcIyk1+iM1zISWJU6N+KoN2MCKbTsqah+HhVnxA6JlNyvmgdRK4Db Za677zrEVby4Xne+6au4n/2MCd3qDmdVGh5VYa1lCmIByBjKn/J882FWuhM1Uza5+3ur Fnp6oPAlZHiJJJNljjmvdoKZz3vsVOn3tKxNAVOW9H/JmY5tfOd39bPzVhXhFGw2hD67 LagQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HiIccaiH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i4si2171580oiy.222.2020.04.08.09.28.36; Wed, 08 Apr 2020 09:28:49 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HiIccaiH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728734AbgDHO0w (ORCPT + 99 others); Wed, 8 Apr 2020 10:26:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49582 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726795AbgDHO0w (ORCPT ); Wed, 8 Apr 2020 10:26:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586356011; h=from:from:reply-to:subject:subject: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=jInxb6S6kno8alLpBOp6oo5DZLTgW5u7AbwcRZ4qu+U=; b=HiIccaiHfJFiRExGzSJ8mzj0/A+q0mb/omA6EjIxKFdx1KpeHNMv99LPGIu8lZVnedUucO f393+KXptk6qRKnH+ZJBW1+tSNeou1whLraN4ddtAOT8F7JhaY75JHDjlQdSEPKJfA/8PQ mJoSFgP3kZ9u3Wjwtn3Q1o7n22z2EFY= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-77-49Dx_m0CMMyPtIq9K6n6ew-1; Wed, 08 Apr 2020 10:26:49 -0400 X-MC-Unique: 49Dx_m0CMMyPtIq9K6n6ew-1 Received: by mail-wr1-f70.google.com with SMTP id u16so4129060wrp.14 for ; Wed, 08 Apr 2020 07:26:49 -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=jInxb6S6kno8alLpBOp6oo5DZLTgW5u7AbwcRZ4qu+U=; b=jzt+xVachTDh1CoLRYeEYxYE6ErKDcF+aIKrAjoRqhIvKmN3n6hcmpm3X0CUkNR51D JvhJsONqUO19oTb5FYVj0poco4FX3BQhIxw6ZJ74n0O4h3OC+eGPK7t5im6DbxUBqq06 c4/qebTr+yGdkhe6rBh4apnEjpS3hIalaK+FTXcDhUqZuebk+3fLEC32YmPjtLaoRQdt /dZckazFkMXZPjVC3kwWn66VAu/0iU3P0WlriauieDp2QB5JzD0imNA79yohNeMYrVSC 1GACFTbZcYIwyqzuf6mre+jr8HywBRbVuBczOrvIt6rhF6I39JwMoP8WE3Eytst84D/c /i/w== X-Gm-Message-State: AGi0PubufXH0EVA2Ioc08IKrWjLCzks0vT/SBSuUQ1itqP/ZQHUwyBUH kJ8K3FNr36Z0oSZ9sAiJve4rYfiByx2onhJApJuaADMDcacnaemArB+dTjXbe0z5r3mN8Oi6Qxx SGm3KjxDWZwSrEuKN0GPKjn3h X-Received: by 2002:a1c:c302:: with SMTP id t2mr5026690wmf.85.1586356008062; Wed, 08 Apr 2020 07:26:48 -0700 (PDT) X-Received: by 2002:a7b:c7cb:: with SMTP id z11mr4837917wmk.15.1586355643514; Wed, 08 Apr 2020 07:20:43 -0700 (PDT) Received: from xz-x1 ([2607:9880:19c0:32::3]) by smtp.gmail.com with ESMTPSA id u6sm29411783wrm.65.2020.04.08.07.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2020 07:20:42 -0700 (PDT) Date: Wed, 8 Apr 2020 10:20:39 -0400 From: Peter Xu To: Michal Hocko 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: <20200408142039.GD66033@xz-x1> References: <20200408014010.80428-1-peterx@redhat.com> <20200408014010.80428-2-peterx@redhat.com> <20200408102128.GX18914@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200408102128.GX18914@dhcp22.suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 saw some other discussions about this return value issue, I'll CC you in the other thread when I raise this as a general question. Thanks, -- Peter Xu