lkml.org 
[lkml]   [2022]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 120/247] m68knommu: set ZERO_PAGE() to the allocated zeroed page
    Date
    From: Greg Ungerer <gerg@linux-m68k.org>

    [ Upstream commit dc068f46217970d9516f16cd37972a01d50dc055 ]

    The non-MMU m68k pagetable ZERO_PAGE() macro is being set to the
    somewhat non-sensical value of "virt_to_page(0)". The zeroth page
    is not in any way guaranteed to be a page full of "0". So the result
    is that ZERO_PAGE() will almost certainly contain random values.

    We already allocate a real "empty_zero_page" in the mm setup code shared
    between MMU m68k and non-MMU m68k. It is just not hooked up to the
    ZERO_PAGE() macro for the non-MMU m68k case.

    Fix ZERO_PAGE() to use the allocated "empty_zero_page" pointer.

    I am not aware of any specific issues caused by the old code.

    Link: https://lore.kernel.org/linux-m68k/2a462b23-5b8e-bbf4-ec7d-778434a3b9d7@google.com/T/#t
    Reported-by: Hugh Dickens <hughd@google.com>
    Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    arch/m68k/include/asm/pgtable_no.h | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
    index 87151d67d91e..bce5ca56c388 100644
    --- a/arch/m68k/include/asm/pgtable_no.h
    +++ b/arch/m68k/include/asm/pgtable_no.h
    @@ -42,7 +42,8 @@ extern void paging_init(void);
    * ZERO_PAGE is a global shared page that is always zero: used
    * for zero-mapped memory areas etc..
    */
    -#define ZERO_PAGE(vaddr) (virt_to_page(0))
    +extern void *empty_zero_page;
    +#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))

    /*
    * All 32bit addresses are effectively valid for vmalloc...
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-13 15:12    [W:4.160 / U:0.520 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site