diff options
author | Ram Pai <linuxram@us.ibm.com> | 2018-01-18 17:50:32 -0800 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-01-20 22:59:01 +1100 |
commit | 5586cf61e108019565bb936daeb296e53df1c1d6 (patch) | |
tree | 254b54bb1a7b565721de3756a2532aab45013968 /arch/powerpc/include/asm/pkeys.h | |
parent | 06bb53b33804613627c7ca1eda246459a7be2803 (diff) | |
download | linux-5586cf61e108019565bb936daeb296e53df1c1d6.tar.bz2 |
powerpc: introduce execute-only pkey
This patch provides the implementation of execute-only pkey.
The architecture-independent layer expects the arch-dependent
layer, to support the ability to create and enable a special
key which has execute-only permission.
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/pkeys.h')
-rw-r--r-- | arch/powerpc/include/asm/pkeys.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h index 41c303a01e1a..b8d2a8e3f2e1 100644 --- a/arch/powerpc/include/asm/pkeys.h +++ b/arch/powerpc/include/asm/pkeys.h @@ -117,9 +117,13 @@ static inline int mm_pkey_free(struct mm_struct *mm, int pkey) * Try to dedicate one of the protection keys to be used as an * execute-only protection key. */ +extern int __execute_only_pkey(struct mm_struct *mm); static inline int execute_only_pkey(struct mm_struct *mm) { - return 0; + if (static_branch_likely(&pkey_disabled)) + return -1; + + return __execute_only_pkey(mm); } static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma, |