lkml.org 
[lkml]   [2020]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 233/261] powerpc/kasan: Fix shadow pages allocation failure
    Date
    From: Christophe Leroy <christophe.leroy@csgroup.eu>

    commit d2a91cef9bbdeb87b7449fdab1a6be6000930210 upstream.

    Doing kasan pages allocation in MMU_init is too early, kernel doesn't
    have access yet to the entire memory space and memblock_alloc() fails
    when the kernel is a bit big.

    Do it from kasan_init() instead.

    Fixes: 2edb16efc899 ("powerpc/32: Add KASAN support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/c24163ee5d5f8cdf52fefa45055ceb35435b8f15.1589866984.git.christophe.leroy@csgroup.eu
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    arch/powerpc/include/asm/kasan.h | 2 --
    arch/powerpc/mm/init_32.c | 2 --
    arch/powerpc/mm/kasan/kasan_init_32.c | 4 +++-
    3 files changed, 3 insertions(+), 5 deletions(-)

    --- a/arch/powerpc/include/asm/kasan.h
    +++ b/arch/powerpc/include/asm/kasan.h
    @@ -27,11 +27,9 @@

    #ifdef CONFIG_KASAN
    void kasan_early_init(void);
    -void kasan_mmu_init(void);
    void kasan_init(void);
    #else
    static inline void kasan_init(void) { }
    -static inline void kasan_mmu_init(void) { }
    #endif

    #endif /* __ASSEMBLY */
    --- a/arch/powerpc/mm/init_32.c
    +++ b/arch/powerpc/mm/init_32.c
    @@ -175,8 +175,6 @@ void __init MMU_init(void)
    btext_unmap();
    #endif

    - kasan_mmu_init();
    -
    setup_kup();

    /* Shortly after that, the entire linear mapping will be available */
    --- a/arch/powerpc/mm/kasan/kasan_init_32.c
    +++ b/arch/powerpc/mm/kasan/kasan_init_32.c
    @@ -129,7 +129,7 @@ static void __init kasan_remap_early_sha
    flush_tlb_kernel_range(KASAN_SHADOW_START, KASAN_SHADOW_END);
    }

    -void __init kasan_mmu_init(void)
    +static void __init kasan_mmu_init(void)
    {
    int ret;
    struct memblock_region *reg;
    @@ -156,6 +156,8 @@ void __init kasan_mmu_init(void)

    void __init kasan_init(void)
    {
    + kasan_mmu_init();
    +
    kasan_remap_early_shadow_ro();

    clear_page(kasan_early_shadow_page);

    \
     
     \ /
      Last update: 2020-06-19 17:15    [W:4.106 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site