• Christophe Leroy's avatar
    powerpc/8xx: Add Kernel Userspace Access Protection · 2679f9bd
    Christophe Leroy authored
    This patch adds Kernel Userspace Access Protection on the 8xx.
    
    When a page is RO or RW, it is set RO or RW for Key 0 and NA
    for Key 1.
    
    Up to now, the User group is defined with Key 0 for both User and
    Supervisor.
    
    By changing the group to Key 0 for User and Key 1 for Supervisor,
    this patch prevents the Kernel from being able to access user data.
    
    At exception entry, the kernel saves SPRN_MD_AP in the regs struct,
    and reapply the protection. At exception exit it restores SPRN_MD_AP
    with the value saved on exception entry.
    Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
    [mpe: Drop allow_read/write_to/from_user() as they're now in kup.h]
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    2679f9bd
kup-8xx.h 1.31 KB