Re: [PATCH 05/23] m68k: allow pte_offset_map[_lock]() to fail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Hugh Dickins <hughd@xxxxxxxxxx>
- Subject: Re: [PATCH 05/23] m68k: allow pte_offset_map[_lock]() to fail
- From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
- Date: Wed, 10 May 2023 09:13:50 +0200
- Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Mike Kravetz <mike.kravetz@xxxxxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>, Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Greg Ungerer <gerg@xxxxxxxxxxxxxx>, Michal Simek <monstr@xxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, John David Anglin <dave.anglin@xxxxxxxx>, "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Heiko Carstens <hca@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>, John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Chris Zankel <chris@xxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, x86@xxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
- In-reply-to: <237c8410-ce61-94c-4260-7318ad6a4f3@google.com>
- References: <77a5d8c-406b-7068-4f17-23b7ac53bc83@google.com> <237c8410-ce61-94c-4260-7318ad6a4f3@google.com>
Hi Hugh,
Thanks for your patch!
On Wed, May 10, 2023 at 6:48 AM Hugh Dickins <hughd@xxxxxxxxxx> wrote:
> In rare transient cases, not yet made possible, pte_offset_map() and
> pte_offset_map_lock() may not find a page table: handle appropriately.
>
> Restructure cf_tlb_miss() with a pte_unmap() (previously omitted)
> at label out, followed by one local_irq_restore() for all.
That's a bug fix, which should be a separate patch?
>
> Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
> --- a/arch/m68k/include/asm/mmu_context.h
> +++ b/arch/m68k/include/asm/mmu_context.h
> @@ -99,7 +99,7 @@ static inline void load_ksp_mmu(struct task_struct *task)
> p4d_t *p4d;
> pud_t *pud;
> pmd_t *pmd;
> - pte_t *pte;
> + pte_t *pte = NULL;
> unsigned long mmuar;
>
> local_irq_save(flags);
> @@ -139,7 +139,7 @@ static inline void load_ksp_mmu(struct task_struct *task)
>
> pte = (mmuar >= PAGE_OFFSET) ? pte_offset_kernel(pmd, mmuar)
> : pte_offset_map(pmd, mmuar);
> - if (pte_none(*pte) || !pte_present(*pte))
> + if (!pte || pte_none(*pte) || !pte_present(*pte))
> goto bug;
If the absence of a pte is to become a non-abnormal case, it should
probably jump to "end" instead, to avoid spamming the kernel log.
>
> set_pte(pte, pte_mkyoung(*pte));
> @@ -161,6 +161,8 @@ static inline void load_ksp_mmu(struct task_struct *task)
> bug:
> pr_info("ksp load failed: mm=0x%p ksp=0x08%lx\n", mm, mmuar);
> end:
> + if (pte && mmuar < PAGE_OFFSET)
> + pte_unmap(pte);
Is this also a bugfix, not mentioned in the patch description?
> local_irq_restore(flags);
> }
>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]