From patchwork Wed May 10 04:43:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13236319 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 B9DADC7EE22 for ; Wed, 10 May 2023 04:43:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23B0E6B0072; Wed, 10 May 2023 00:43:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EC126B0074; Wed, 10 May 2023 00:43:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B46B6B0075; Wed, 10 May 2023 00:43:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F2ED36B0072 for ; Wed, 10 May 2023 00:43:53 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B9D8F1A0492 for ; Wed, 10 May 2023 04:43:53 +0000 (UTC) X-FDA: 80773102746.24.50BA60C Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf30.hostedemail.com (Postfix) with ESMTP id E8B9D80005 for ; Wed, 10 May 2023 04:43:51 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=XSdzuZPh; spf=pass (imf30.hostedemail.com: domain of hughd@google.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683693832; a=rsa-sha256; cv=none; b=60HnuMcUcY5XmHm7T8ftHiEjAgdwNX0xZmMB6LpP3KiQPkrfN/jwIFcjJig61iNIoJI46y N49OhoU6RW15DIBKFLW2y1ITao9BkefZENtSk4QnkSiBq7u+J030FsciA5i9GS0kl/RltE nj4ch8fgC5sVU11o7Ylot97KlBCzD8E= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=XSdzuZPh; spf=pass (imf30.hostedemail.com: domain of hughd@google.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683693832; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Qgvg6hJeX3BMksFNsRntaPo5LAnqTckLGOVnbotKcuE=; b=mqugUOqPDyb69QhubAacb6je6SFSOg/xQiV7S1cIsNxgafGCJv3YlwWh6tfCL2UM/RpOmm WGWruXN5OpH/tjMAwQQYVRBfbTT/l2R/v4tjs7fat2zhDWAar062CIerjvWWrSmcfgF+Ks lGRn4/FBCuDTbCT/Km6YBpmx+6Pgo9E= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-55aa1da9d4aso120819907b3.2 for ; Tue, 09 May 2023 21:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683693831; x=1686285831; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=Qgvg6hJeX3BMksFNsRntaPo5LAnqTckLGOVnbotKcuE=; b=XSdzuZPhWyo8ejurmvHVm33GJPjVUgijuALNChj5du7O2iYt4Q9Jq2Q59opuXgmszK vq4MYv/Ooq0tJSiRkeuI3pPx9DX2hUCIacbsKIYs/Pr4tOgH5bBu2nqMFCUfyb6E02pf jBk8Kt3LARkTDDVXin2DqNhLRNsinTPL45U22h6RflNgwq03hTBYZXyT9mTDfKsms4Zh 4IIRYWo2iyv3RHOXtIB0KC/5A3EJw7nNYEHLsDPx36g0ObzRlzcFoxapfv0z0w7dMYbs CoJBrp445oAQqRN0sKHpj5OzjqC03ok8JMyhyd58GQQ6Bw92QvpdqQzmSHjTpSRLST1k j19g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683693831; x=1686285831; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qgvg6hJeX3BMksFNsRntaPo5LAnqTckLGOVnbotKcuE=; b=BvAfvOMCCDLnwZ6IPLu6Z20TX2aY88exIQH0WFtCNPkuviVJfHKPutjuyZUdmzar0b 1J5gNucSkQ5oIR2cBQ+8yFD2bDLpRZi9K+wqHrD6LA5OD1fe/kOM3ECKDgU2ns0oU90N jrjhRWufHdrL6AraHEoxwU5FHpjUHowc27D33yYN70FWcyUb2E54BSEj46CZVNWq/6Zg 5SuV1AmkEAx2Ono25QXoCkeZSSVT2m/hAA7OcyUPAVw/xVCDKIrUIijYLdEQESytsYVg ilLmiiClAJqQ3zbj1+0xCTx4mXhzhE97vipNmCBtqF5HI1/627PcNl0qy4qe2jnN5ceE hB0w== X-Gm-Message-State: AC+VfDwT7dgClGUOJPNgD6xmZozY2mN+FEi6w6eMbVb9XDGtWosEmzR4 SwrAK2oW6y2BACMHsZRrCphr4g== X-Google-Smtp-Source: ACHHUZ4VcJ8uys5Wg+XhQi/AqGcqZN5zPbzkOujNssPmQqlmUArRuZ8YDG3LYugsQYwQAHxQcBQMpA== X-Received: by 2002:a0d:d955:0:b0:55a:ad0a:766 with SMTP id b82-20020a0dd955000000b0055aad0a0766mr17833906ywe.10.1683693830970; Tue, 09 May 2023 21:43:50 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id p185-20020a0dcdc2000000b0055a72f6a462sm2214413ywd.19.2023.05.09.21.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 May 2023 21:43:50 -0700 (PDT) Date: Tue, 9 May 2023 21:43:47 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Greg Ungerer , Michal Simek , Thomas Bogendoerfer , Helge Deller , John David Anglin , "Aneesh Kumar K.V" , Michael Ellerman , Alexandre Ghiti , Palmer Dabbelt , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , John Paul Adrian Glaubitz , "David S. Miller" , Chris Zankel , Max Filippov , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/23] arm64: allow pte_offset_map() to fail In-Reply-To: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> Message-ID: References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E8B9D80005 X-Stat-Signature: h9iir36inrqz8ddkws6s7i4b86wbpxze X-HE-Tag: 1683693831-411345 X-HE-Meta: U2FsdGVkX18ZpZ4zCOvscklIqT5i0ronCsQhIUEXGuTIeTpdwSpq1vDbAxzDs1lxcAQeZ3o4agIPSF7TSMwt3EQapCauHmBx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g2YLnHJnOiup659nG9npu/vSCNZ7eoEyj6TTpW2xRRYRLH3i6NmAbvrNcrBlVOZErwYoTy+/PY6eVAHxBOmM/grzU9DMN0NctRCOtZg0M2JAc3UAbpnsslLfsQRb5R4BbdeHJX5tc8DCSZN0cRlzJQvKKnh/ZnT2L71IpQ2zkg8tSdLMk2oDuizEwu2GFxZkigem2Z+fqhLfDzzxZ2su7v+jys5HdQmhYttohF+dV/rf/eSbz4W1eZaeR+hmBbggkac5tOPTmAsg== 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: In rare transient cases, not yet made possible, pte_offset_map() and pte_offset_map_lock() may not find a page table: handle appropriately. Signed-off-by: Hugh Dickins Acked-by: Catalin Marinas --- arch/arm64/mm/fault.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 9e0db5c387e3..a58780d5fac4 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -177,6 +177,9 @@ static void show_pte(unsigned long addr) break; ptep = pte_offset_map(pmdp, addr); + if (!ptep) + break; + pte = READ_ONCE(*ptep); pr_cont(", pte=%016llx", pte_val(pte)); pte_unmap(ptep);