summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/pkeys.h
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2018-01-19 04:50:29 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-20 14:58:59 +0300
commit2ddc53f3a7516b3e2c4ab9c36854a227641a4fde (patch)
treed9902039301c44908f92ac7a23242cbdb9261ca5 /arch/powerpc/include/asm/pkeys.h
parent0685f217afe8279a754490954b8dcc02cb763a5d (diff)
downloadlinux-2ddc53f3a7516b3e2c4ab9c36854a227641a4fde.tar.xz
powerpc: implementation for arch_set_user_pkey_access()
This patch provides the detailed implementation for a user to allocate a key and enable it in the hardware. It provides the plumbing, but it cannot be used till the system call is implemented. The next patch will do so. Reviewed-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.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.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h
index 5ed52ac39bab..bf8e706dcb0f 100644
--- a/arch/powerpc/include/asm/pkeys.h
+++ b/arch/powerpc/include/asm/pkeys.h
@@ -128,10 +128,14 @@ static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma,
return 0;
}
+extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
+ unsigned long init_val);
static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
unsigned long init_val)
{
- return 0;
+ if (static_branch_likely(&pkey_disabled))
+ return -EINVAL;
+ return __arch_set_user_pkey_access(tsk, pkey, init_val);
}
extern void pkey_mm_init(struct mm_struct *mm);