• Joey Gouly's avatar
    selftests: mm: make protection_keys test work on arm64 · f5b5ea51
    Joey Gouly authored
    The encoding of the pkey register differs on arm64, than on x86/ppc. On those
    platforms, a bit in the register is used to disable permissions, for arm64, a
    bit enabled in the register indicates that the permission is allowed.
    
    This drops two asserts of the form:
    	 assert(read_pkey_reg() <= orig_pkey_reg);
    Because on arm64 this doesn't hold, due to the encoding.
    
    The pkey must be reset to both access allow and write allow in the signal
    handler. pkey_access_allow() works currently for PowerPC as the
    PKEY_DISABLE_ACCESS and PKEY_DISABLE_WRITE have overlapping bits set.
    
    Access to the uc_mcontext is abstracted, as arm64 has a different structure.
    Signed-off-by: default avatarJoey Gouly <joey.gouly@arm.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Shuah Khan <shuah@kernel.org>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
    Acked-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/r/20240822151113.1479789-27-joey.gouly@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    f5b5ea51
pkey-helpers.h 5.47 KB