Received: by 10.213.65.68 with SMTP id h4csp3812846imn; Tue, 10 Apr 2018 05:13:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49rjRRojY+TghWizMES4H2A8TLLUN8bHiPr11x6LstxqTN9HDZWt1rDUvtZiOHpWDBvzo9x X-Received: by 2002:a17:902:6590:: with SMTP id c16-v6mr170116plk.292.1523362384677; Tue, 10 Apr 2018 05:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523362384; cv=none; d=google.com; s=arc-20160816; b=DHc2kF3IgJpvbP4buocFWkuu973wuE/mEb5S+gNJM60B8QA92Di4eXAccasrD/IODh RGZ9cBDi8XV1ga4OUHxdMJzQEFdC442F+iEA6zEx+ljnIkU4g1feXpGgpdoFGD1r4KqD uM0YH/SnD8pVSnOpuvw7QIjVI+mJcIrnQr4SRnW0tDzdMrSDfSjtvHkZXWnd3K7lz1bW jP00lKryAEH2s9Ms4FRApIcbtclp+fy/Xc4qgVslqvA4V7rn5D9Uaw/90Hichx+u6462 qmMOTX2HxeugxOmzrwBErYmL+RBU+BtwyXyMREGyw33AaFrS+kbdXiiRdWuEtJtehJzy 1AJw== 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:dkim-signature:arc-authentication-results; bh=NSQOSkNJD9icbq4xbtl543omIyTrxJr028uM8cyzD0A=; b=QArd9m3sVKU2O8IIEHmOCcf7ZHB9oNd8aQ9tEEeYgH9SJJ2YMlAygbUCE18u1X8Gef gXdCUopIMmFtHLIdprBt3RJ+k4YnXFYqE4rjnWw3Jw/JJYmhnY2sfy9WgLe4xVXp6HUy CNjVo/nv3PSgnlMbX371TKRSDh1QRcqvGN7VCCkaHsOsNXg9bM8jQPiaz7KX9hRbCRFb 12jNi4Gl6k39d/huALKhN6Lq6bWCi8v1ZpfIBuPqfyHmvfsNm01P3+fCV1z7sUBA/0MN YwyeF6gIkBwZL5zJ28/wKyRUQfxTQqRrkMy24m3tcZuDcl+1Ty2/uuHlncdCJrnbNabP DKvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QuXdtTCI; 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 h9si1914925pfn.237.2018.04.10.05.12.27; Tue, 10 Apr 2018 05:13:04 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QuXdtTCI; 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 S1752804AbeDJMFd (ORCPT + 99 others); Tue, 10 Apr 2018 08:05:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42854 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbeDJMFb (ORCPT ); Tue, 10 Apr 2018 08:05:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NSQOSkNJD9icbq4xbtl543omIyTrxJr028uM8cyzD0A=; b=QuXdtTCIjPiaPkZYTxImOStU2 ISmPtBOpGT3P1VdXQlhLAIHfaRxeNPWQqrP0sww0bZMSwDE8YLxyEu4s+PXGAY9sRs9fUcP2UQSEf DKhU8dXIioPGlQfM4VrcOftXA78QQAY/hUs13XRzC1eKLq5llMOc7H5Z4/NrqPlKJ20xltoL7Go1C WjDsRBrzNp9Jq8mQ4slB0BjUvru9nn3FhuToz+sCXlmvArwmPfJY9DRt2411Bq3JgImms7aGEUXFC WjlOvm/elRIeltnJUXk7NTbEleVz3NQvg4cUbdCes6YcKBH/tb69tL6RQDY1jSfHQjY44aVZIG8Lr 6vBVVGdDA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5s1g-00020W-JS; Tue, 10 Apr 2018 12:05:28 +0000 Date: Tue, 10 Apr 2018 05:05:28 -0700 From: Matthew Wilcox To: Michal Hocko Cc: Jaegeuk Kim , Minchan Kim , Christopher Lameter , Andrew Morton , linux-mm , LKML , Johannes Weiner , Jan Kara , Chris Fries , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] mm: workingset: fix NULL ptr dereference Message-ID: <20180410120528.GB22118@bombadil.infradead.org> References: <20180409015815.235943-1-minchan@kernel.org> <20180409024925.GA21889@bombadil.infradead.org> <20180409030930.GA214930@rodete-desktop-imager.corp.google.com> <20180409111403.GA31652@bombadil.infradead.org> <20180409112514.GA195937@rodete-laptop-imager.corp.google.com> <20180409183827.GD17558@jaegeuk-macbookpro.roam.corp.google.com> <20180409194044.GA15295@bombadil.infradead.org> <20180410082643.GX21835@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410082643.GX21835@dhcp22.suse.cz> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 10, 2018 at 10:26:43AM +0200, Michal Hocko wrote: > On Mon 09-04-18 12:40:44, Matthew Wilcox wrote: > > The problem is that the mapping gfp flags are used not only for allocating > > pages, but also for allocating the page cache data structures that hold > > the pages. F2FS is the only filesystem that set the __GFP_ZERO bit, > > so it's the first time anyone's noticed that the page cache passes the > > __GFP_ZERO bit through to the radix tree allocation routines, which > > causes the radix tree nodes to be zeroed instead of constructed. > > > > I think the right solution to this is: > > This just hides the underlying problem that the node is not fully and > properly initialized. Relying on the previous released state is just too > subtle. That's the fundamental design of slab-with-constructors. The user provides a constructor, so all newly allocagted objects are initialised to a known state, then the user will restore the object to that state when it frees the object to slab. > Are you going to blacklist all potential gfp flags that come > from the mapping? This is just unmaintainable! If anything this should > be an explicit & with the allowed set of allowed flags. Oh, I agree that using the set of flags used to allocate the page in order to allocate the radix tree nodes is a pretty horrible idea. Your suggestion, then, is: - error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM); + error = radix_tree_preload(gfp_mask & GFP_RECLAIM_MASK); correct?