• Christophe Leroy's avatar
    powerpc/40x: Introduce _PAGE_READ and remove _PAGE_USER · ed815bd3
    Christophe Leroy authored
    _PAGE_USER is used to select the zone. Today zone 0 is kernel
    and zone 1 is user.
    
    To implement _PAGE_NONE, _PAGE_USER is cleared, leading to no access
    for user but kernel still has access to the page so it's possible for
    a user application to write in that page by using a kernel function
    as trampoline.
    
    What is really wanted is to have user rights on pages below TASK_SIZE
    and no user rights on pages above TASK_SIZE. Use zones for that.
    There are 16 zones so lets use the 4 upper address bits to set the
    zone and declare zone rights based on TASK_SIZE.
    
    Then drop _PAGE_USER and reuse it as _PAGE_READ that will be checked
    in Data TLB miss handler. That will properly handle PAGE_NONE for
    both kernel and user.
    
    In addition, it partially implements execute-only right. The
    implementation won't be complete because once a TLB has been loaded
    via the Instruction TLB miss handler, it will be possible to read
    the page. But at least it can't be read unless it is executed first.
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/2a13e3ba8a5dec43143cc1f9a91ec71ea1529f3c.1695659959.git.christophe.leroy@csgroup.eu
    ed815bd3
head_40x.S 20.2 KB