lkml.org 
[lkml]   [2021]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v1 13/15] powerpc/kuap: Wire-up KUAP on 85xx in 32 bits mode.
    Date
    This adds KUAP support to 85xx in 32 bits mode.
    This is done by reading the content of SPRN_MAS1 and checking
    the TID at the time user pgtable is loaded.

    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    ---
    arch/powerpc/kernel/head_fsl_booke.S | 12 ++++++++++++
    arch/powerpc/platforms/Kconfig.cputype | 1 +
    2 files changed, 13 insertions(+)

    diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
    index 0a9a0f301474..44f7271194e5 100644
    --- a/arch/powerpc/kernel/head_fsl_booke.S
    +++ b/arch/powerpc/kernel/head_fsl_booke.S
    @@ -462,6 +462,12 @@ END_BTB_FLUSH_SECTION
    mfspr r11,SPRN_SPRG_THREAD
    lwz r11,PGDIR(r11)

    +#ifdef CONFIG_PPC_KUAP
    + mfspr r12, SPRN_MAS1
    + rlwinm. r12,r12,0,0x3fff0000
    + beq 2f /* KUAP fault */
    +#endif
    +
    4:
    /* Mask of required permission bits. Note that while we
    * do copy ESR:ST to _PAGE_RW position as trying to write
    @@ -571,6 +577,12 @@ END_BTB_FLUSH_SECTION
    mfspr r11,SPRN_SPRG_THREAD
    lwz r11,PGDIR(r11)

    +#ifdef CONFIG_PPC_KUAP
    + mfspr r12, SPRN_MAS1
    + rlwinm. r12,r12,0,0x3fff0000
    + beq 2f /* KUAP fault */
    +#endif
    +
    /* Make up the required permissions for user code */
    #ifdef CONFIG_PTE_64BIT
    li r13,_PAGE_PRESENT | _PAGE_BAP_UX
    diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
    index 3fdc10bc4aab..8152eeba8572 100644
    --- a/arch/powerpc/platforms/Kconfig.cputype
    +++ b/arch/powerpc/platforms/Kconfig.cputype
    @@ -37,6 +37,7 @@ config PPC_BOOK3S_32
    config PPC_85xx
    bool "Freescale 85xx"
    select E500
    + select PPC_HAVE_KUAP

    config PPC_8xx
    bool "Freescale 8xx"
    --
    2.31.1
    \
     
     \ /
      Last update: 2021-10-06 14:49    [W:2.447 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site