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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3BB2C433EF for ; Wed, 19 Jan 2022 16:27:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C98C6B0072; Wed, 19 Jan 2022 11:27:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 478EA6B0073; Wed, 19 Jan 2022 11:27:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3684E6B0074; Wed, 19 Jan 2022 11:27:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 288876B0072 for ; Wed, 19 Jan 2022 11:27:51 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D77FF8FD2F for ; Wed, 19 Jan 2022 16:27:50 +0000 (UTC) X-FDA: 79047567900.30.A58BDC0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id DC30C80006 for ; Wed, 19 Jan 2022 16:27:49 +0000 (UTC) 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: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: DC30C80006 X-Stat-Signature: rjduusugags94girphqbrk5g8kik6b85 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hs7gAhpA; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1642609669-593170 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, 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.