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: 91849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3362964vqo; Tue, 9 May 2023 21:47:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MK5Qo5G5nPY683ZXRN5dotrN8uSGCoGdUtsNC2EqI+gmF//CySXjvCp5m0on83QmaGDzp X-Received: by 2002:a17:902:cece:b0:1a6:413c:4a3e with SMTP id d14-20020a170902cece00b001a6413c4a3emr20961376plg.5.1683694056294; Tue, 09 May 2023 21:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683694056; cv=none; d=google.com; s=arc-20160816; b=WaPbuAxiEbWfiaqg/PMWBXjzLP3a9hzoyLhE7L9nvvqAgtXAnrPAuhvQ1lrLsyBa7d 6gE59MyQ7mHcJoONWVIpCfE4BxS75T1DxjA1YvmDi/Zapvj6nzzQp6AyEP8aiP4i0X18 qkUtGV8h1fHtbpuKn15RTaTcu5x7hO5VzLcHFjtYaMEaXP/+LYj9f7xNDgoEh4Ln5NbQ Vb90bK6Thfw4aohAjn75gHjgT7nveLPGWBIQLFtTuVcZd7mMvdeUXAi+kEOMrgP08m3g hDw2ZOM1ayWvjHcEMra/KsXxc3AXJ4QywIRAFV3Nf5vXYF3MZa2/KeXakYkFKMy07Tet wIOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Qgvg6hJeX3BMksFNsRntaPo5LAnqTckLGOVnbotKcuE=; b=avpl3IWIbsqwJyaRRcRXeeF3EKSTK/A2CXiKbQs34qbtShuRVtOaTsq9nEc22T8rJi kCC3NywalqkwzjAdKkQjiFYWhBfdNd8HaL+q6C9r/Q/AxhAwZSYRrt8PbIsZqWw/FVWg VJiAm6jBZ2wiMzN9rMxo+4M/3lJBygKQvhAGR/41CTdm2OanUnSuZWXp3c/5PaAIH+px vspuwiF51hJr1ChmHxw2m6xFQ4ztfpXR2yzANaktM+f08LdLVpL8ytMIt2uXQmersCCR b8vTmsotebz2R+1VkP3DeGcTyY9nnlvxDuv9s7JwECsZu9WTtbrFUxqipR8ntIsfcATN N4Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=XSdzuZPh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170902e54500b001a8173f468fsi3464263plf.314.2023.05.09.21.47.24; Tue, 09 May 2023 21:47:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=XSdzuZPh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234216AbjEJEoA (ORCPT + 99 others); Wed, 10 May 2023 00:44:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjEJEny (ORCPT ); Wed, 10 May 2023 00:43:54 -0400 Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94BF40EB for ; Tue, 9 May 2023 21:43:51 -0700 (PDT) Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-55a20a56a01so120775387b3.3 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=k2VaXXj4IMX/S5r+nliEovK/Rilc1vpSqOCnTximAd+GKrb9g3hafTrfe8SN5OctMO EME/Lsa7C0WZwnxuvYsm31XpiLLaKtpcQbUXuPsAEtyQRr0g0U2pQWLL9xZmHktiH2ot AfX6TRQBpeAEb58OQIz258GOSEfvKpdZHSlUv32ePeNeD032MhzJcb7RXSkC0lPRSmqF xKLEXCai7MTLIJ3lnlRJXSyz6K17onM6juYMkNgESUEpoRsTnDJ0Wyj/PVT24aYxgwiq ikqfhyKvN//PF63Ei/m1k1s7oIcLS7MGSMwNXQOmk7h5+yWRbY43LYNDzeHU6ZvsBH24 XtGg== X-Gm-Message-State: AC+VfDxS49hCZXxKmNXwwd8xe+wVRQp9JlATNBRp+WlCR5nr42HiOKvf cWWquWY0fj8/70a0tnBmWC1EoQ== 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-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765481178911571086?= X-GMAIL-MSGID: =?utf-8?q?1765481178911571086?= 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);