blob: 0794ca78c379a609c576e975a1a0acbbb218d978 [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
5#include <linux/mm_types.h>
6#include <asm/mmu_context.h>
7
Dave Hansen66d37572016-02-12 13:02:32 -08008#ifdef CONFIG_ARCH_HAS_PKEYS
9#include <asm/pkeys.h>
10#else /* ! CONFIG_ARCH_HAS_PKEYS */
11#define arch_max_pkey() (1)
Dave Hansen62b5f7d2016-02-12 13:02:40 -080012#define execute_only_pkey(mm) (0)
13#define arch_override_mprotect_pkey(vma, prot, pkey) (0)
14#define PKEY_DEDICATED_EXECUTE_ONLY 0
Dave Hansena8502b62016-07-29 09:30:13 -070015#define ARCH_VM_PKEY_FLAGS 0
Dave Hansene8c24d32016-07-29 09:30:15 -070016
17static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey)
18{
19 return (pkey == 0);
20}
21
22static inline int mm_pkey_alloc(struct mm_struct *mm)
23{
24 return -1;
25}
26
27static inline int mm_pkey_free(struct mm_struct *mm, int pkey)
28{
Dave Hansene8c24d32016-07-29 09:30:15 -070029 return -EINVAL;
30}
31
32static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
33 unsigned long init_val)
34{
35 return 0;
36}
37
Dave Hansenacd547b2016-07-29 09:30:21 -070038static inline void copy_init_pkru_to_fpregs(void)
39{
40}
41
Dave Hansen66d37572016-02-12 13:02:32 -080042#endif /* ! CONFIG_ARCH_HAS_PKEYS */
43
Dave Hansen66d37572016-02-12 13:02:32 -080044#endif /* _LINUX_PKEYS_H */