blob: 2955ba97604892ab14a7e6b0cb532136aef85943 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Dave Hansen66d37572016-02-12 13:02:32 -08002#ifndef _LINUX_PKEYS_H
3#define _LINUX_PKEYS_H
4
Michael Ellerman555934a2018-04-12 23:54:00 +10005#include <linux/mm.h>
Dave Hansen66d37572016-02-12 13:02:32 -08006
Dave Hansen66d37572016-02-12 13:02:32 -08007#ifdef CONFIG_ARCH_HAS_PKEYS
8#include <asm/pkeys.h>
9#else /* ! CONFIG_ARCH_HAS_PKEYS */
10#define arch_max_pkey() (1)
Dave Hansen62b5f7d2016-02-12 13:02:40 -080011#define execute_only_pkey(mm) (0)
12#define arch_override_mprotect_pkey(vma, prot, pkey) (0)
13#define PKEY_DEDICATED_EXECUTE_ONLY 0
Dave Hansena8502b62016-07-29 09:30:13 -070014#define ARCH_VM_PKEY_FLAGS 0
Dave Hansene8c24d32016-07-29 09:30:15 -070015
Michael Ellermandbec10e2018-04-11 23:41:42 +100016static inline int vma_pkey(struct vm_area_struct *vma)
17{
18 return 0;
19}
20
Dave Hansene8c24d32016-07-29 09:30:15 -070021static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
22{
23 return (pkey == 0);
24}
25
26static inline int mm_pkey_alloc(struct mm_struct *mm)
27{
28 return -1;
29}
30
31static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
32{
Dave Hansene8c24d32016-07-29 09:30:15 -070033 return -EINVAL;
34}
35
36static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
37 unsigned long init_val)
38{
39 return 0;
40}
41
Michael Ellerman4414ef92018-04-13 23:54:52 +100042static inline bool arch_pkeys_enabled(void)
43{
44 return false;
45}
46
Dave Hansenacd547b2016-07-29 09:30:21 -070047static inline void copy_init_pkru_to_fpregs(void)
48{
49}
50
Dave Hansen66d37572016-02-12 13:02:32 -080051#endif /* ! CONFIG_ARCH_HAS_PKEYS */
52
Dave Hansen66d37572016-02-12 13:02:32 -080053#endif /* _LINUX_PKEYS_H */