Message ID | 22165adb-581c-9ce1-8aa6-a3385cd39055@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 666CCC7EE29 for <linux-mm@archiver.kernel.org>; Thu, 8 Jun 2023 19:32:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 053768E0002; Thu, 8 Jun 2023 15:32:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0039E8E0001; Thu, 8 Jun 2023 15:32:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0E258E0002; Thu, 8 Jun 2023 15:32:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D453F8E0001 for <linux-mm@kvack.org>; Thu, 8 Jun 2023 15:32:43 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A8F88C0475 for <linux-mm@kvack.org>; Thu, 8 Jun 2023 19:32:43 +0000 (UTC) X-FDA: 80880577806.26.FE51C66 Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) by imf16.hostedemail.com (Postfix) with ESMTP id CAF4B180010 for <linux-mm@kvack.org>; Thu, 8 Jun 2023 19:32:41 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=24t2BtFN; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of hughd@google.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686252761; 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=5V1nU3Kqzs/xawWKyc6+rxjcg3uMlDunTMtenGe5HoU=; b=RRyHSgZWMlAn3nu1+3dpIlAUsMNJ1CGb9VJUPNtNHN/hXz0B3pRIKPL+jMju5+xtL0WZVa Q0zb82r83oBHMUe+qqQMf8TS6RsAqcgvfV5WEHosAQfSOMS68YxPdicLybIR20ejAq9VfJ Z5dD1pyUIMaRnnRKk2DDFQmOG4EgeDo= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=24t2BtFN; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of hughd@google.com designates 209.85.219.174 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686252761; a=rsa-sha256; cv=none; b=JSZy1U9RqJVn8XA4aNjTTzkeSETOIoe6OEuXo/VC+vqCUwWW8A53jh5qnuJPa0vhFmPRll FfKVjmTvhEw3KE0gEchvh1sgl8Iwzt9Lg8XQQ0DT6WV9onOds3J4CLcpsej9TDZ9tc1Gjj t/5nG4lDLCH2PCM4Ej9vxKvjkSWZaMA= Received: by mail-yb1-f174.google.com with SMTP id 3f1490d57ef6-bacfb7acdb7so1080730276.0 for <linux-mm@kvack.org>; Thu, 08 Jun 2023 12:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686252761; x=1688844761; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=5V1nU3Kqzs/xawWKyc6+rxjcg3uMlDunTMtenGe5HoU=; b=24t2BtFN5HXeEnWp4wmjqaz3ba7RZTv3BWN8E2lDsHPicXiEJRz9TlH2WLVzGd8CdE of2yNqyqdnSUhfcGIlOsfvovWhpuG53taZz/x9DR/Th5PIOmYH7IKtDML+zGnAiDR7yW CrmldFZSb2omivw75gysl+pOyy7IV7uE8SzN+doaYOlbMw3OdLZlcS0TMi0ZgvmIeRDQ MJq/tuPeT8xPnNmBXjEKmMP3qPQGwnStEjRQklqNa0dtkxFHtF5PvuvrSEAvR9DPSdcW McnyT5sGz87Djsd0XbZMK04rqnZG7iDmeQmmJXSZxSQJU2i6hoMEpfITW8x1lOY4n4VU tBMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686252761; x=1688844761; 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=5V1nU3Kqzs/xawWKyc6+rxjcg3uMlDunTMtenGe5HoU=; b=cOxMuPoIVgKO9TpFguuLAhF37ZBPbGPsmBS8+mqv1K8OzzXPfupojM3pst9vNqveuG O3XRJVj8eCzjTM5rV5wVwr5JGpYtKL/EZvLI0k6H+Os0wRzL56kA1ok/P+GUtfwiS5zf W8CZ8+d1ouEIt2NTWlnDf6GN5XjCkibgyf6FRowR6H0DMWtpXRZgDAQOG9Cgoh2m+EqU mXF6ib3hRd6R4JagCwBQarxrDhFoClMUbBnQGG3TBAk5G9pZsjD8U45yuFWkr6v9m0R/ x9hRVirKLjzGmgCidnSelLsJs/o6ee20o7OdFD620TXnXdJSxMvtTV9lmix+Qhzd3la/ QmlQ== X-Gm-Message-State: AC+VfDzEeBVPEeK264nMFvN+i71YmLvojzStCZzTc4YcuwjmPl4WCodN mD6fkOIg5Ve3qv5fx0QTlHy9NQ== X-Google-Smtp-Source: ACHHUZ6ZLPO3tFN/Ri9lGF19A4q4QfMsE5CXjcYyyqXlwc0QGFL9qBHigDBgxXippDMgVek84lg5YA== X-Received: by 2002:a25:f40b:0:b0:ba8:54c4:3136 with SMTP id q11-20020a25f40b000000b00ba854c43136mr602795ybd.52.1686252760634; Thu, 08 Jun 2023 12:32:40 -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 k7-20020a258c07000000b00bb0ae4221b8sm428913ybl.43.2023.06.08.12.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 12:32:40 -0700 (PDT) Date: Thu, 8 Jun 2023 12:32:36 -0700 (PDT) From: Hugh Dickins <hughd@google.com> X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton <akpm@linux-foundation.org> cc: Mike Kravetz <mike.kravetz@oracle.com>, Mike Rapoport <rppt@kernel.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Matthew Wilcox <willy@infradead.org>, David Hildenbrand <david@redhat.com>, Suren Baghdasaryan <surenb@google.com>, Qi Zheng <zhengqi.arch@bytedance.com>, Peter Zijlstra <peterz@infradead.org>, Russell King <linux@armlinux.org.uk>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Greg Ungerer <gerg@linux-m68k.org>, Michal Simek <monstr@monstr.eu>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Helge Deller <deller@gmx.de>, John David Anglin <dave.anglin@bell.net>, "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>, Alexandre Ghiti <alexghiti@rivosinc.com>, Palmer Dabbelt <palmer@dabbelt.com>, Heiko Carstens <hca@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, "David S. Miller" <davem@davemloft.net>, Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>, 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 19/23] sparc: allow pte_offset_map() to fail In-Reply-To: <a4963be9-7aa6-350-66d0-2ba843e1af44@google.com> Message-ID: <22165adb-581c-9ce1-8aa6-a3385cd39055@google.com> References: <a4963be9-7aa6-350-66d0-2ba843e1af44@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CAF4B180010 X-Stat-Signature: pzpdbrcjf3a88tahbd5acr1d7k4p1e3u X-HE-Tag: 1686252761-565537 X-HE-Meta: U2FsdGVkX1/HBey7IHS3eSt66s9mhtiSRYvyQ0n2oyu4eFdzDfyQvGT8WZR1sNjsu9Y++CSMBtQkGpo1jjViwpXe8gnHBDNG/NIq7aGe1ULkXD9ad2uC+2PserC5BSzwttk4jxq78KlVyaVlqm/lBrtbYkuf6FrVQfYxPGFFppGAHMsVQ4q39DGDTJ9o8fm7U92zDzGcanvGanyuTbueoiqsnIfD6iuuoJSDDUoWVdSbHnt6UQQvV3iBV5FFNZKpiPdpwetcPVgtnlUtwH6a3OGfAX234fBJxp9yCmm5CkI5AFTRZl7TJIMO4ZKIlGU1mwA0sxbdRw3sznpwTevAN7Q43snIkvU4KlQbczrxYL7QGMClmpN5mfTX8i5CacMGhut61cZ5VNFX6/L6IVWjhp2Bm9+X518IiNKvIeRHBxMb/udnLUNKWsFhDxczSf04PopuXOvvn7Ou/+bXcli/eruABT8LDUxO6cDZR9wzDWLWC/3N6AV3MbgVHp3pLdnxraJ9xJtxtMGmj9Bz5Vve3zJsoJp0jHrLhnrvIUJrv3LW0UBFl94AdkZXpJ/xZHEd4G7VdXYWCTAloR/Nf3vtzXtmj2ABHk9lXP9w2EJdvdDCxITDDrFgTs8/BmbI2E/0TNfHfVbGj+P6f2HxKQU0yD3cnfLHD34IdBWg0RtygTVo0RTAq7/0iBFSM5//xw6iK+RKwPoLpeDaTbTDFGE7OeBLxFnBfRl7zuHVch90Jct0dPrGvSZ2prZppDEGADG0vZIWFr/o+LLxjtV5eETS2Rd6NDace6IJoBvokmKGX6golsYI9OvNqCfU2M1P44VyUoxR+BV1B6PinTku3ZkmlWWFnC3VOOxQDeOJzfJiiC6AUsCplRXppWHat8VNkRcljvrx7jdhDwh9yFEN9DXeAGkdgiyJ0pwm9F03p4sUU/Sz06Fp9DGfPgFJYW5i0toT3lJMemXS8REa/5qUpYR 2V+YywOz +lFTBi/KwnzzOoJCPRTrX8PD0uRA7tSLIXRQvDQx1WSyyzA6plmmOyyhpTZYAv0tYPoiRUrgEhxSTezGL91kPSc2OMWxzdrxOf/2Xcv7Ptz5Urdry0S9fXQFSBaOJR3YYe4bIYPRpIq5BMmEs8ITnkGixKKtLzc2ImEOe65ummqb9/0/FtgCyFtB1A2JjoatguvLJ54RQUQfQCY4s0TY2UfzAwZp07jrEEIEAAq7fxJESf+Q8AahGT2EYSuELRcNHE0zWYp17FqcpOnmEjieG2L3/Fm69z7KljVG7gWPVOOcJwXKm5p63tbu4Y0n9ANy2KdK0SH2/cGWhehUM4ErYmZdVqIs6LtOw232/gr2GsfzmdmVQkW2fgpIuLAuvfnY2Eipv9Ag0fMZzx+dC0ezI415H3DdycW4vk/Ue0KFkWAF0hJah10XQOXQ2OQ== 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: <linux-mm.kvack.org> |
Series |
arch: allow pte_offset_map[_lock]() to fail
|
expand
|
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index dad38960d1a8..ca450c7bc53f 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c @@ -328,6 +328,8 @@ static void flush_signal_insns(unsigned long address) goto out_irqs_on; ptep = pte_offset_map(pmdp, address); + if (!ptep) + goto out_irqs_on; pte = *ptep; if (!pte_present(pte)) goto out_unmap; diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index d91305de694c..d8a407fbe350 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c @@ -99,6 +99,7 @@ static unsigned int get_user_insn(unsigned long tpc) local_irq_disable(); pmdp = pmd_offset(pudp, tpc); +again: if (pmd_none(*pmdp) || unlikely(pmd_bad(*pmdp))) goto out_irq_enable; @@ -115,6 +116,8 @@ static unsigned int get_user_insn(unsigned long tpc) #endif { ptep = pte_offset_map(pmdp, tpc); + if (!ptep) + goto again; pte = *ptep; if (pte_present(pte)) { pa = (pte_pfn(pte) << PAGE_SHIFT); diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c index 9a725547578e..7ecf8556947a 100644 --- a/arch/sparc/mm/tlb.c +++ b/arch/sparc/mm/tlb.c @@ -149,6 +149,8 @@ static void tlb_batch_pmd_scan(struct mm_struct *mm, unsigned long vaddr, pte_t *pte; pte = pte_offset_map(&pmd, vaddr); + if (!pte) + return; end = vaddr + HPAGE_SIZE; while (vaddr < end) { if (pte_val(*pte) & _PAGE_VALID) {
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 <hughd@google.com> --- arch/sparc/kernel/signal32.c | 2 ++ arch/sparc/mm/fault_64.c | 3 +++ arch/sparc/mm/tlb.c | 2 ++ 3 files changed, 7 insertions(+)