Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1188160pxb; Fri, 21 Jan 2022 11:49:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUSM9yQqvS9bidJCRb+1QALVX9xF28vQioy5GA08KZH/2UjEHvvCxfBxdfDjgaiQwHzehf X-Received: by 2002:a63:2047:: with SMTP id r7mr3991815pgm.424.1642794558702; Fri, 21 Jan 2022 11:49:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642794558; cv=none; d=google.com; s=arc-20160816; b=w2+vvnl5P06T0T7or+/Tapt7XY6AeXvuhywpt5tZrcCwT1ldapFQc4Z5AbQzryMtvt rTqNoCeyz8jMXw+va4riXAKIhUqsIagNHKFNsflL0H0SlQ9JeCS1BsLRDmVa7xvNZ0Kl g0Iyfi8wHN0jSdMdnmNq8hoS1m5OI+0WCujirivzx+NO/iD7UUttiUvTPjMkX9cx2kal n+rXgZRH7HmtxLAht0tcQghpP6BT4lDCAX+tgJxfHl6XuvsxB/ZOhccPJAb/dsc7G2JI ia9uNgwRu8W8DlzXNSL7/dHNR6t1JH+RWhuG/1y+aZl7GgoSNCztdIylEsrQJTYT7wvS zOkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=y+niaJZsQwGraQM2Scy9GSfhLJjB89yjTH8KmflesUE=; b=sF286wExWQY37mOL7Z9NbHG5/Cb8c07uCXeKTw6oFGlEMZU20paJN1D3C8/dFR6O8i Ba/2G0PX3iLhNfPC4KuOoQzw29/cfZLDT7ndEWMOh8tXG9BCkJC6RY0Ohwsjls4i9GWX wQdOZSwwdhXPohpJ7XSPcS6CcbzSugrjyrrd89KToXB8W+6rs30hHM49G6QLhVpmtMJ4 anODjqvRhnRqbxQjZd+TLD/37//xvX6SWRj+dFw3UpKVT3mdLVxmqILysY4WMZ/gDP+c kTAbF1Jdd8gVXsI9CNsMv9Fxioa/h+LMTU5/vAnO6hbAoTeXuyBxK+gSsOnI4p6BZD9n NnOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hs7gAhpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v17si8043468pfu.177.2022.01.21.11.49.05; Fri, 21 Jan 2022 11:49:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hs7gAhpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356039AbiASQ1t (ORCPT + 99 others); Wed, 19 Jan 2022 11:27:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231857AbiASQ1t (ORCPT ); Wed, 19 Jan 2022 11:27:49 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E522BC061574 for ; Wed, 19 Jan 2022 08:27:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=y+niaJZsQwGraQM2Scy9GSfhLJjB89yjTH8KmflesUE=; b=hs7gAhpAa0jbycG+pHIUD140H9 MEc+Hhq9eXKkyB0ZBoX20pZhcH702XDPdl5aDHEgFlg7mw328ff9uPl/On17vMLICS7HNqXgYJj9p HkkRkhyAQLTk3OaC+Kj0EivULkAFGsg+VVrlLX+gsKLAwbCbbo4R9hfYu4l+U++XbGuNCxfGtNM9C RG8WwC6bGESqC7Io4ngPhQcqcVUodlUVvf6g88ntU95gCwbxj0HskVMh0IvZxrGp11RwR1LUoo+v/ +yVHv5m8ZevAwlTKx1WW+yL36OKShVEA9sHg+xOpGXMj5oyKLrF/4iWVSrbhD1orgxvNKPndmPDkS G0OQRXGQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nADo4-00BMnH-Eq; Wed, 19 Jan 2022 16:27:32 +0000 Date: Wed, 19 Jan 2022 16:27:32 +0000 From: Matthew Wilcox To: Robin Murphy Cc: Yury Norov , Catalin Marinas , Will Deacon , Andrew Morton , Nicholas Piggin , Ding Tianhong , Anshuman Khandual , Alexey Klimov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] vmap(): don't allow invalid pages Message-ID: References: <20220118235244.540103-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 19, 2022 at 01:28:14PM +0000, Robin Murphy wrote: > > + if (WARN_ON(!pfn_valid(page_to_pfn(page)))) > > Is it page_to_pfn() guaranteed to work without blowing up if page is invalid > in the first place? Looking at the CONFIG_SPARSEMEM case I'm not sure that's > true... Even if it does blow up, at least it's blowing up here where someone can start to debug it, rather than blowing up on first access, where we no longer have the invlid struct page pointer. I don't think we have a 'page_valid' function which will tell us whether a random pointer is actually a struct page or not.