/linux-master/arch/powerpc/include/asm/ |
H A D | pkeys.h | 33 static inline u64 pkey_to_vmflag_bits(u16 pkey) argument 35 return (((u64)pkey << VM_PKEY_SHIFT) & ARCH_VM_PKEY_FLAGS); 50 #define pkey_alloc_mask(pkey) (0x1 << pkey) 54 #define __mm_pkey_allocated(mm, pkey) { \ 55 mm_pkey_allocation_map(mm) |= pkey_alloc_mask(pkey); \ 58 #define __mm_pkey_free(mm, pkey) { \ 59 mm_pkey_allocation_map(mm) &= ~pkey_alloc_mask(pkey); \ 62 #define __mm_pkey_is_allocated(mm, pkey) \ 63 (mm_pkey_allocation_map(mm) & pkey_alloc_mask(pkey)) 68 mm_pkey_is_allocated(struct mm_struct *mm, int pkey) argument 110 mm_pkey_free(struct mm_struct *mm, int pkey) argument 130 arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey) argument 148 arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val) argument [all...] |
H A D | mman.h | 18 unsigned long pkey) 21 return (((prot & PROT_SAO) ? VM_SAO : 0) | pkey_to_vmflag_bits(pkey)); 26 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) 17 arch_calc_vm_prot_bits(unsigned long prot, unsigned long pkey) argument
|
/linux-master/arch/x86/include/asm/ |
H A D | pkeys.h | 12 extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, 34 int prot, int pkey); 36 int prot, int pkey) 41 return __arch_override_mprotect_pkey(vma, prot, pkey); 47 #define mm_set_pkey_allocated(mm, pkey) do { \ 48 mm_pkey_allocation_map(mm) |= (1U << pkey); \ 50 #define mm_set_pkey_free(mm, pkey) do { \ 51 mm_pkey_allocation_map(mm) &= ~(1U << pkey); \ 55 bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) argument 59 * from pkey_alloc() or pkey 35 arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey) argument 108 mm_pkey_free(struct mm_struct *mm, int pkey) argument [all...] |
H A D | pkru.h | 19 static inline bool __pkru_allows_read(u32 pkru, u16 pkey) argument 21 int pkru_pkey_bits = pkey * PKRU_BITS_PER_PKEY; 25 static inline bool __pkru_allows_write(u32 pkru, u16 pkey) argument 27 int pkru_pkey_bits = pkey * PKRU_BITS_PER_PKEY;
|
/linux-master/include/linux/ |
H A D | pkeys.h | 14 #define arch_override_mprotect_pkey(vma, prot, pkey) (0) 23 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) argument 25 return (pkey == 0); 33 static inline int mm_pkey_free(struct mm_struct *mm, int pkey) argument 38 static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, argument
|
/linux-master/security/selinux/ |
H A D | ibpkey.c | 47 * sel_ib_pkey_hashfn - Hashing function for the pkey table 48 * @pkey: pkey number 51 * This is the hashing function for the pkey table, it returns the bucket 52 * number for the given pkey. 55 static unsigned int sel_ib_pkey_hashfn(u16 pkey) argument 57 return (pkey & (SEL_PKEY_HASH_SIZE - 1)); 61 * sel_ib_pkey_find - Search for a pkey record 66 * Search the pkey table and return the matching record. If an entry 73 struct sel_ib_pkey *pkey; local 93 sel_ib_pkey_insert(struct sel_ib_pkey *pkey) argument 132 struct sel_ib_pkey *pkey; local 183 struct sel_ib_pkey *pkey; local 207 struct sel_ib_pkey *pkey, *pkey_tmp; local [all...] |
/linux-master/crypto/asymmetric_keys/ |
H A D | public_key.c | 67 software_key_determine_akcipher(const struct public_key *pkey, argument 79 if (strcmp(pkey->pkey_algo, "rsa") == 0) { 89 pkey->pkey_algo); 93 pkey->pkey_algo, hash_algo); 106 } else if (strncmp(pkey->pkey_algo, "ecdsa", 5) == 0) { 127 } else if (strcmp(pkey->pkey_algo, "sm2") == 0) { 134 } else if (strcmp(pkey->pkey_algo, "ecrdsa") == 0) { 146 if (strscpy(alg_name, pkey->pkey_algo, CRYPTO_MAX_ALG_NAME) < 0) 164 struct public_key *pkey = params->key->payload.data[asym_crypto]; local 171 ret = software_key_determine_akcipher(pkey, param 279 const struct public_key *pkey = params->key->payload.data[asym_crypto]; local 382 public_key_verify_signature(const struct public_key *pkey, const struct public_key_signature *sig) argument [all...] |
H A D | restrict.c | 135 const struct public_key *pkey; local 140 pkey = payload->data[asym_crypto]; 141 if (!pkey) 143 if (!test_bit(KEY_EFLAG_CA, &pkey->key_eflags)) 145 if (!test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags)) 149 if (test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) 176 const struct public_key *pkey; local 181 pkey = payload->data[asym_crypto]; 183 if (!pkey) 186 if (!test_bit(KEY_EFLAG_DIGITALSIG, &pkey [all...] |
/linux-master/security/selinux/include/ |
H A D | ibpkey.h | 3 * pkey table 22 int sel_ib_pkey_sid(u64 subnet_prefix, u16 pkey, u32 *sid); 28 static inline int sel_ib_pkey_sid(u64 subnet_prefix, u16 pkey, u32 *sid) argument
|
/linux-master/tools/testing/selftests/powerpc/include/ |
H A D | pkeys.h | 52 void pkey_set_rights(int pkey, unsigned long rights) argument 56 shift = (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY; 63 int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey) argument 65 return syscall(__NR_pkey_mprotect, addr, len, prot, pkey); 73 int sys_pkey_free(int pkey) argument 75 return syscall(__NR_pkey_free, pkey); 81 int pkey; local 88 pkey = sys_pkey_alloc(0, 0); 89 SKIP_IF(pkey < 0); 90 sys_pkey_free(pkey); [all...] |
/linux-master/tools/testing/selftests/mm/ |
H A D | protection_keys.c | 7 * * how to set/clear bits in pkey registers (the rights register) 8 * * how to handle SEGV_PKUERR signals and extract pkey-relevant 17 * look for pkey "leaks" where it is still set on a VMA but "freed" back to the kernel 18 * do a plain mprotect() to a mprotect_pkey() area and make sure the pkey sticks 49 #include "pkey-helpers.h" 179 static u32 hw_pkey_get(int pkey, unsigned long flags) argument 183 dprintf1("%s(pkey=%d, flags=%lx) = %x / %d\n", 184 __func__, pkey, flags, 0, 0); 187 return (u32) get_pkey_bits(pkey_reg, pkey); 190 static int hw_pkey_set(int pkey, unsigne argument 211 pkey_disable_set(int pkey, int flags) argument 252 pkey_disable_clear(int pkey, int flags) argument 281 pkey_write_allow(int pkey) argument 285 pkey_write_deny(int pkey) argument 289 pkey_access_allow(int pkey) argument 293 pkey_access_deny(int pkey) argument 462 sys_mprotect_pkey(void *ptr, size_t size, unsigned long orig_prot, unsigned long pkey) argument 536 sys_pkey_free(unsigned long pkey) argument 588 mprotect_pkey(void *ptr, size_t size, unsigned long orig_prot, unsigned long pkey) argument 697 malloc_pkey_with_mprotect(long size, int prot, u16 pkey) argument 717 malloc_pkey_anon_huge(long size, int prot, u16 pkey) argument 798 malloc_pkey_hugetlb(long size, int prot, u16 pkey) argument 819 malloc_pkey_mmap_dax(long size, int prot, u16 pkey) argument 854 malloc_pkey(long size, int prot, u16 pkey) argument 886 expected_pkey_fault(int pkey) argument 964 test_pkey_alloc_free_attach_pkey0(int *ptr, u16 pkey) argument 1016 test_read_of_write_disabled_region(int *ptr, u16 pkey) argument 1026 test_read_of_access_disabled_region(int *ptr, u16 pkey) argument 1038 test_read_of_access_disabled_region_with_page_already_mapped(int *ptr, u16 pkey) argument 1055 test_write_of_write_disabled_region_with_page_already_mapped(int *ptr, u16 pkey) argument 1066 test_write_of_write_disabled_region(int *ptr, u16 pkey) argument 1073 test_write_of_access_disabled_region(int *ptr, u16 pkey) argument 1081 test_write_of_access_disabled_region_with_page_already_mapped(int *ptr, u16 pkey) argument 1092 test_kernel_write_of_access_disabled_region(int *ptr, u16 pkey) argument 1104 test_kernel_write_of_write_disabled_region(int *ptr, u16 pkey) argument 1117 test_kernel_gup_of_access_disabled_region(int *ptr, u16 pkey) argument 1139 test_kernel_gup_write_to_write_disabled_region(int *ptr, u16 pkey) argument 1157 test_pkey_syscalls_on_non_allocated_pkey(int *ptr, u16 pkey) argument 1180 test_pkey_syscalls_bad_args(int *ptr, u16 pkey) argument 1206 test_pkey_alloc_exhaust(int *ptr, u16 pkey) argument 1312 test_pkey_init_state(int *ptr, u16 pkey) argument 1350 test_mprotect_with_pkey_0(int *ptr, u16 pkey) argument 1374 test_ptrace_of_child(int *ptr, u16 pkey) argument 1471 test_executing_on_unreadable_memory(int *ptr, u16 pkey) argument 1498 test_implicit_mprotect_exec_only_memory(int *ptr, u16 pkey) argument 1547 test_ptrace_modifies_pkru(int *ptr, u16 pkey) argument 1669 test_mprotect_pkey_on_unsupported_cpu(int *ptr, u16 pkey) argument 1715 int pkey; local [all...] |
H A D | pkey-powerpc.h | 23 #define NR_RESERVED_PKEYS_4K 27 /* pkey-0, pkey-1, exec-only-pkey 26 #define NR_RESERVED_PKEYS_64K_3KEYS 3 /* PowerNV and KVM: pkey-0, 27 pkey-1 and exec-only key */ 28 #define NR_RESERVED_PKEYS_64K_4KEYS 4 /* PowerVM: pkey-0, pkey-1, 29 pkey-31 and exec-only key */ 34 static inline u32 pkey_bit_position(int pkey) argument 36 return (NR_PKEYS - pkey 91 expect_fault_on_read_execonly_key(void *p1, int pkey) argument 105 malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) argument [all...] |
H A D | pkey-helpers.h | 83 void expected_pkey_fault(int pkey); 85 int sys_pkey_free(unsigned long pkey); 87 unsigned long pkey); 91 #include "pkey-x86.h" 93 #include "pkey-powerpc.h" 100 static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags) argument 102 u32 shift = pkey_bit_position(pkey); 103 /* mask out bits from pkey in old value */ 105 /* OR in new bits for pkey */ 110 static inline u64 get_pkey_bits(u64 reg, int pkey) argument 152 __pkey_access_allow(int pkey, int do_allow) argument 166 __pkey_write_allow(int pkey, int do_allow_write) argument [all...] |
H A D | pkey-x86.h | 27 #define NR_RESERVED_PKEYS 2 /* pkey-0 and exec-only-pkey */ 101 static inline u32 pkey_bit_position(int pkey) argument 103 return pkey * PKEY_BITS_PER_PKEY; 145 void expect_fault_on_read_execonly_key(void *p1, int pkey) argument 151 expected_pkey_fault(pkey); 154 void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) argument
|
/linux-master/tools/testing/selftests/powerpc/mm/ |
H A D | pkey_exec_prot.c | 69 sigsafe_err("got a fault for an unexpected pkey\n"); 79 * Reassociate the exec-only pkey with the region 106 int pkey, ret, i; local 153 /* Allocate a pkey that restricts execution */ 155 pkey = sys_pkey_alloc(0, rights); 156 FAIL_IF(pkey < 0); 170 * are not set i.e. the pkey permits both read and write 174 * implies PROT_READ on GNU systems. The pkey currently 179 FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0); 180 printf("read from %p, pkey permission [all...] |
/linux-master/drivers/infiniband/ulp/ipoib/ |
H A D | ipoib_vlan.c | 60 * Since the legacy sysfs interface uses pkey for deletion it cannot 61 * support more than one interface with the same pkey, it creates 73 if (ppriv->pkey == priv->pkey) 77 if (tpriv->pkey == priv->pkey && 95 u16 pkey, int type) 115 if (pkey == 0 || pkey == 0x8000) { 123 priv->pkey 94 __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv, u16 pkey, int type) argument 167 ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) argument 247 ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) argument [all...] |
/linux-master/arch/arm64/include/asm/ |
H A D | mman.h | 10 unsigned long pkey __always_unused) 22 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey)
|
/linux-master/drivers/infiniband/core/ |
H A D | security.c | 48 struct pkey_index_qp_list *pkey = NULL; local 56 pkey = tmp_pkey; 61 return pkey; 65 u16 *pkey, 71 ret = ib_get_cached_pkey(dev, pp->port_num, pp->pkey_index, pkey); 80 static int enforce_qp_pkey_security(u16 pkey, argument 87 ret = security_ib_pkey_access(qp_sec->security, subnet_prefix, pkey); 96 pkey); 115 u16 pkey; local 123 &pkey, 64 get_pkey_and_subnet_prefix(struct ib_port_pkey *pp, u16 *pkey, u64 *subnet_prefix) argument 194 check_pkey_qps(struct pkey_index_qp_list *pkey, struct ib_device *device, u32 port_num, u64 subnet_prefix) argument 246 struct pkey_index_qp_list *pkey; local 304 struct pkey_index_qp_list *pkey; local 544 struct pkey_index_qp_list *pkey; local 557 struct pkey_index_qp_list *pkey, *tmp_pkey; local 657 u16 pkey; local [all...] |
/linux-master/arch/x86/mm/ |
H A D | pkeys.c | 20 /* Do we need to assign a pkey for mm's execute-only maps? */ 32 * first and assume that if the execute-only pkey is 76 int __arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey) argument 82 if (pkey != -1) 83 return pkey; 92 pkey = execute_only_pkey(vma->vm_mm); 93 if (pkey > 0) 94 return pkey; 98 * is using the exec-only pkey. This mapping was 100 * the default pkey [all...] |
/linux-master/arch/powerpc/mm/book3s64/ |
H A D | pkeys.c | 49 #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey+1) * AMR_BITS_PER_PKEY)) 123 * pkey_to_vmflag_bits() assumes that the pkey bits are contiguous 136 /* scan the device tree for pkey feature */ 315 static inline void init_amr(int pkey, u8 init_bits) argument 317 u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey)); 318 u64 old_amr = current_thread_amr() & ~((u64)(0x3ul) << pkeyshift(pkey)); 323 static inline void init_iamr(int pkey, u8 init_bits) argument 325 u64 new_iamr_bits = (((u64)init_bits & 0x1UL) << pkeyshift(pkey)); 326 u64 old_iamr = current_thread_iamr() & ~((u64)(0x1ul) << pkeyshift(pkey)); 338 __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val) argument 391 __arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey) argument 415 pkey_access_permitted(int pkey, bool write, bool execute) argument [all...] |
/linux-master/arch/powerpc/include/asm/book3s/64/ |
H A D | pkeys.h | 6 #include <asm/book3s/64/hash-pkey.h>
|
/linux-master/arch/s390/include/asm/ |
H A D | pkey.h | 3 * Kernelspace interface to the pkey device driver 16 #include <uapi/asm/pkey.h>
|
/linux-master/tools/testing/selftests/powerpc/ptrace/ |
H A D | Makefile | 12 TESTS_64 += core-pkey 16 TESTS_64 += ptrace-pkey 40 $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
|
/linux-master/drivers/s390/crypto/ |
H A D | Makefile | 16 # pkey kernel module 17 pkey-objs := pkey_api.o 18 obj-$(CONFIG_PKEY) += pkey.o
|
/linux-master/include/rdma/ |
H A D | ib_cache.h | 40 * @pkey: The PKey value found at the specified index. 48 u16 *pkey); 55 * @pkey: The PKey value to search for. 63 u16 pkey, 71 * @pkey: The PKey value to search for. 79 u16 pkey,
|