From patchwork Thu Jun 8 19:11:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 105106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp494908vqr; Thu, 8 Jun 2023 12:26:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73mmH56xBiqQ2pp7OWxqQbmtLS09lbFVLlfaGVJoWn9PZ8r9ihksT9n/IDxnMssGXJLzP+ X-Received: by 2002:a05:6a20:7346:b0:10b:aeff:aa00 with SMTP id v6-20020a056a20734600b0010baeffaa00mr3347519pzc.28.1686252387427; Thu, 08 Jun 2023 12:26:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686252387; cv=none; d=google.com; s=arc-20160816; b=tQ8ANeifUgNuCiD71UkDYtb52fXk1cqeVInCtwSg4hHpi9voKke+ygJybOwzkxjSiO M16ZLT7DZpJWCsPbVkQq82qkgkosn8xC/4lFAn2tSTIFjjKNnw5JRipFO70/spvetPF3 5tTVK+XyEfGV2w1Ijm69ZHJmdOTYpMmCF5dtlHUYheryEjiMohCDACO7aDkhObHY/ZLe TDxB8P3FBKUjRVPa1qhBPKYufgv8mnu9Hbel5uf1Nwb2Ms7o9F7UuG+Co7PHnvP+DcwM 0mcNxhEzZdNoVKujgEOeOWOu1zHXCLDH4adkMZMeKHA83jl6gUo0CU8iyS4gRGRw0PJa 4+rw== 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=zVLRceEeXaiGvlgxdYbIgAo+AcDyW1dS+jDGBb+h1UA=; b=GEIdR4gHdsTD4arf0X9V3W5e/nqB72LjOhEcZbMp6h3CZ84RvFgYjwkGm8UYpjVZ2R X8FoWaHmX9iJo28rfRXtP9njSTfW2GF0QQOyRfaFFktKrVHYbi8LFQ62bv1ucajBl6ua stu0vzKOiyW6EerEDnpJDazVN8c8Wv2vZaWRtyxE0QTFvtBDBxw/zDiuUto/IaGdIbZL mbsLmRi5Tiiw4iwEkSe0koAzvlhTPRPfqShk2gmg2DiuclWUvDYFf7chpX7DzOybxi+I e8ODyh/R8ek2NVv5xT8RM3PVbwdkay9GBuu9uFOlhPeBYVS28P/q4n1ogRZ0VzLzG0PQ Q0AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=1l3g323z; 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 v135-20020a63618d000000b0053ef5472637si1411524pgb.150.2023.06.08.12.26.15; Thu, 08 Jun 2023 12:26:27 -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=1l3g323z; 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 S236100AbjFHTMS (ORCPT + 99 others); Thu, 8 Jun 2023 15:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235928AbjFHTML (ORCPT ); Thu, 8 Jun 2023 15:12:11 -0400 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3572F2D7C for ; Thu, 8 Jun 2023 12:12:05 -0700 (PDT) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-565de553de1so14703657b3.0 for ; Thu, 08 Jun 2023 12:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686251524; x=1688843524; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=zVLRceEeXaiGvlgxdYbIgAo+AcDyW1dS+jDGBb+h1UA=; b=1l3g323zHExDgYGww0zFXmVgic3jDwyc0JAOaU14MB4NUoruSezWtFEVocvA8VR+wP D+bOPBhVpeN5TR7Q94HiD/7UXFwgvkn75HwqVtdM3hi/WhalPJUwiHRXSp3bpeKIuRdm orIqBvL0rae06pUEOxuRX8a0MpgqpKjI5TTzLJ98WQmBBEIDz4RhToD7qotfuISdygmL gKqyyQ61v8JQcZhpfriPzCyTWiXBbfQnLuFCKxtspZkjhV60I7fgSoyr0iHs2+KGMqLW csaRWwWg7YMEgY5GV8POPk7y+6y3olAQXOM6liWFfJYYRJ0sFo+4jM2u98tnCjYnFP0Y 93kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686251524; x=1688843524; 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=zVLRceEeXaiGvlgxdYbIgAo+AcDyW1dS+jDGBb+h1UA=; b=KDqAl8fhTocZHQ7v36L0meK+90AQBiFK3i5OBsuYNl/EGTu03L2VpilEmSZkXD6/9v nSVG9KHOjHobW2wdpSrYpEtsN2wu85kMDt0LDQLYepYF2mxbDaqRGKPt1wDOQi2mKLJ9 qlIXQmZrqYFfs85HN7zskIpt7//OqQuDHYcoshxwWqQiG33gidauETAhDnWW+1L8rAlJ Wbnme/Zj8a4mm9fAoHYUIedjvsWChsmrrgLnNbpIv6K9/x+qRD+jzT5vxHos7QvLGQKw nSKhW10M4O3W5paTCpIMPFkvb2SXm7o2IPLrSrLXpZOtvj2XLGlu5UrKd5YDDJCO1mRd hVfQ== X-Gm-Message-State: AC+VfDz0668+H7YCE4Q9uBScD0PwfP8EBxpM77j/NAv6vhhl82FGeYSa dUTyNi6OH14GJ9wHdS81mIGBlQ== X-Received: by 2002:a0d:ead2:0:b0:569:ec03:14eb with SMTP id t201-20020a0dead2000000b00569ec0314ebmr668029ywe.23.1686251523870; Thu, 08 Jun 2023 12:12:03 -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 d144-20020a814f96000000b00559f1cb8444sm106718ywb.70.2023.06.08.12.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 12:12:03 -0700 (PDT) Date: Thu, 8 Jun 2023 12:11:59 -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 , Peter Zijlstra , 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 , Alexander Gordeev , 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 v2 02/23] arm64: allow pte_offset_map() to fail In-Reply-To: Message-ID: <35e46485-8499-4337-c51f-b8fa495a1a93@google.com> References: 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?1768163783521106466?= X-GMAIL-MSGID: =?utf-8?q?1768163783521106466?= 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 cb21ccd7940d..f3aaba853547 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);