| /linux/arch/powerpc/include/asm/ |
| H A D | pkeys.h | 33 static inline vm_flags_t pkey_to_vmflag_bits(u16 pkey) in pkey_to_vmflag_bits() argument 35 return (((vm_flags_t)pkey << VM_PKEY_SHIFT) & ARCH_VM_PKEY_FLAGS); in pkey_to_vmflag_bits() 50 #define pkey_alloc_mask(pkey) (0x1 << pkey) argument 54 #define __mm_pkey_allocated(mm, pkey) { \ argument 55 mm_pkey_allocation_map(mm) |= pkey_alloc_mask(pkey); \ 58 #define __mm_pkey_free(mm, pkey) { \ argument 59 mm_pkey_allocation_map(mm) &= ~pkey_alloc_mask(pkey); \ 62 #define __mm_pkey_is_allocated(mm, pkey) \ argument 63 (mm_pkey_allocation_map(mm) & pkey_alloc_mask(pkey)) 65 #define __mm_pkey_is_reserved(pkey) (reserved_allocation_mask & \ argument [all …]
|
| /linux/crypto/asymmetric_keys/ |
| H A D | public_key.c | 67 software_key_determine_akcipher(const struct public_key *pkey, in software_key_determine_akcipher() argument 79 if (strcmp(pkey->pkey_algo, "rsa") == 0) { in software_key_determine_akcipher() 93 pkey->pkey_algo); in software_key_determine_akcipher() 99 pkey->pkey_algo, hash_algo); in software_key_determine_akcipher() 112 } else if (strncmp(pkey->pkey_algo, "ecdsa", 5) == 0) { in software_key_determine_akcipher() 135 encoding, pkey->pkey_algo); in software_key_determine_akcipher() 137 } else if (strcmp(pkey->pkey_algo, "ecrdsa") == 0) { in software_key_determine_akcipher() 149 if (strscpy(alg_name, pkey->pkey_algo, CRYPTO_MAX_ALG_NAME) < 0) in software_key_determine_akcipher() 166 struct public_key *pkey = params->key->payload.data[asym_crypto]; in software_key_query() local 172 ret = software_key_determine_akcipher(pkey, params->encoding, in software_key_query() [all …]
|
| H A D | restrict.c | 135 const struct public_key *pkey; in restrict_link_by_ca() local 140 pkey = payload->data[asym_crypto]; in restrict_link_by_ca() 141 if (!pkey) in restrict_link_by_ca() 143 if (!test_bit(KEY_EFLAG_CA, &pkey->key_eflags)) in restrict_link_by_ca() 145 if (!test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags)) in restrict_link_by_ca() 149 if (test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) in restrict_link_by_ca() 176 const struct public_key *pkey; in restrict_link_by_digsig() local 181 pkey = payload->data[asym_crypto]; in restrict_link_by_digsig() 183 if (!pkey) in restrict_link_by_digsig() 186 if (!test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) in restrict_link_by_digsig() [all …]
|
| /linux/security/selinux/ |
| H A D | ibpkey.c | 55 static unsigned int sel_ib_pkey_hashfn(u16 pkey) in sel_ib_pkey_hashfn() argument 57 return (pkey & (SEL_PKEY_HASH_SIZE - 1)); in sel_ib_pkey_hashfn() 73 struct sel_ib_pkey *pkey; in sel_ib_pkey_find() local 76 list_for_each_entry_rcu(pkey, &sel_ib_pkey_hash[idx].list, list) { in sel_ib_pkey_find() 77 if (pkey->psec.pkey == pkey_num && in sel_ib_pkey_find() 78 pkey->psec.subnet_prefix == subnet_prefix) in sel_ib_pkey_find() 79 return pkey; in sel_ib_pkey_find() 93 static void sel_ib_pkey_insert(struct sel_ib_pkey *pkey) in sel_ib_pkey_insert() argument 100 idx = sel_ib_pkey_hashfn(pkey->psec.pkey); in sel_ib_pkey_insert() 101 list_add_rcu(&pkey->list, &sel_ib_pkey_hash[idx].list); in sel_ib_pkey_insert() [all …]
|
| /linux/tools/testing/selftests/mm/ |
| H A D | protection_keys.c | 184 static u32 hw_pkey_get(int pkey, unsigned long flags) in hw_pkey_get() argument 189 __func__, pkey, flags, 0, 0); in hw_pkey_get() 192 return (u32) get_pkey_bits(pkey_reg, pkey); in hw_pkey_get() 195 static int hw_pkey_set(int pkey, unsigned long rights, unsigned long flags) in hw_pkey_set() argument 205 new_pkey_reg = set_pkey_bits(old_pkey_reg, pkey, rights); in hw_pkey_set() 211 __func__, pkey, rights, flags, 0, __read_pkey_reg(), in hw_pkey_set() 216 static void pkey_disable_set(int pkey, int flags) in pkey_disable_set() argument 223 pkey, flags); in pkey_disable_set() 226 pkey_rights = hw_pkey_get(pkey, syscall_flags); in pkey_disable_set() 229 pkey, pkey, pkey_rights); in pkey_disable_set() [all …]
|
| H A D | pkey-arm64.h | 74 static inline u32 pkey_bit_position(int pkey) in pkey_bit_position() argument 76 return pkey * PKEY_BITS_PER_PKEY; in pkey_bit_position() 84 static inline void expect_fault_on_read_execonly_key(void *p1, int pkey) in expect_fault_on_read_execonly_key() argument 88 static inline void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) in malloc_pkey_with_mprotect_subpage() argument 94 static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags) in set_pkey_bits() argument 96 u32 shift = pkey_bit_position(pkey); in set_pkey_bits() 114 static inline u64 get_pkey_bits(u64 reg, int pkey) in get_pkey_bits() argument 116 u32 shift = pkey_bit_position(pkey); in get_pkey_bits() 130 static inline void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey) in aarch64_write_signal_pkey() argument 137 poe_ctx->por_el0 = pkey; in aarch64_write_signal_pkey()
|
| H A D | pkey_util.c | 16 int sys_pkey_free(unsigned long pkey) in sys_pkey_free() argument 18 int ret = syscall(SYS_pkey_free, pkey); in sys_pkey_free() 19 dprintf1("%s(pkey=%ld) syscall ret: %d\n", __func__, pkey, ret); in sys_pkey_free() 24 unsigned long pkey) in sys_mprotect_pkey() argument 29 ptr, size, orig_prot, pkey); in sys_mprotect_pkey() 32 sret = syscall(__NR_pkey_mprotect, ptr, size, orig_prot, pkey); in sys_mprotect_pkey()
|
| H A D | pkey-powerpc.h | 39 static inline u32 pkey_bit_position(int pkey) in pkey_bit_position() argument 41 return (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY; in pkey_bit_position() 96 static inline void expect_fault_on_read_execonly_key(void *p1, int pkey) in expect_fault_on_read_execonly_key() argument 120 static inline void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) in malloc_pkey_with_mprotect_subpage() argument 126 size, prot, pkey); in malloc_pkey_with_mprotect_subpage() 127 pkey_assert(pkey < NR_PKEYS); in malloc_pkey_with_mprotect_subpage() 137 ret = mprotect_pkey((void *)ptr, PAGE_SIZE, prot, pkey); in malloc_pkey_with_mprotect_subpage() 141 dprintf1("%s() for pkey %d @ %p\n", __func__, pkey, ptr); in malloc_pkey_with_mprotect_subpage()
|
| H A D | pkey-helpers.h | 89 int sys_pkey_free(unsigned long pkey); 91 unsigned long pkey); 95 void expected_pkey_fault(int pkey); 97 unsigned long pkey); 122 static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags) in set_pkey_bits() argument 124 u32 shift = pkey_bit_position(pkey); in set_pkey_bits() 134 static inline u64 get_pkey_bits(u64 reg, int pkey) in get_pkey_bits() argument 136 u32 shift = pkey_bit_position(pkey); in get_pkey_bits()
|
| /linux/arch/arm64/include/asm/ |
| H A D | pkeys.h | 15 int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, 29 int prot, int pkey) in arch_override_mprotect_pkey() argument 31 if (pkey != -1) in arch_override_mprotect_pkey() 32 return pkey; in arch_override_mprotect_pkey() 44 #define mm_set_pkey_allocated(mm, pkey) do { \ argument 45 mm_pkey_allocation_map(mm) |= (1U << pkey); \ 47 #define mm_set_pkey_free(mm, pkey) do { \ argument 48 mm_pkey_allocation_map(mm) &= ~(1U << pkey); \ 51 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) in mm_pkey_is_allocated() argument 58 if (pkey < 0 || pkey >= arch_max_pkey()) in mm_pkey_is_allocated() [all …]
|
| H A D | por.h | 13 static inline bool por_elx_allows_read(u64 por, u8 pkey) in por_elx_allows_read() argument 15 u8 perm = POR_ELx_PERM_GET(pkey, por); in por_elx_allows_read() 20 static inline bool por_elx_allows_write(u64 por, u8 pkey) in por_elx_allows_write() argument 22 u8 perm = POR_ELx_PERM_GET(pkey, por); in por_elx_allows_write() 27 static inline bool por_elx_allows_exec(u64 por, u8 pkey) in por_elx_allows_exec() argument 29 u8 perm = POR_ELx_PERM_GET(pkey, por); in por_elx_allows_exec()
|
| H A D | mman.h | 15 unsigned long pkey) in arch_calc_vm_prot_bits() argument 27 ret |= pkey & BIT(0) ? VM_PKEY_BIT0 : 0; in arch_calc_vm_prot_bits() 28 ret |= pkey & BIT(1) ? VM_PKEY_BIT1 : 0; in arch_calc_vm_prot_bits() 29 ret |= pkey & BIT(2) ? VM_PKEY_BIT2 : 0; in arch_calc_vm_prot_bits() 35 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) argument
|
| /linux/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) in arch_override_mprotect_pkey() argument 41 return __arch_override_mprotect_pkey(vma, prot, pkey); in arch_override_mprotect_pkey() 47 #define mm_set_pkey_allocated(mm, pkey) do { \ argument 48 mm_pkey_allocation_map(mm) |= (1U << pkey); \ 50 #define mm_set_pkey_free(mm, pkey) do { \ argument 51 mm_pkey_allocation_map(mm) &= ~(1U << pkey); \ 55 bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) in mm_pkey_is_allocated() argument 62 if (pkey < 0) in mm_pkey_is_allocated() [all …]
|
| /linux/drivers/infiniband/core/ |
| H A D | security.c | 48 struct pkey_index_qp_list *pkey = NULL; in get_pkey_idx_qp_list() local 56 pkey = tmp_pkey; in get_pkey_idx_qp_list() 61 return pkey; in get_pkey_idx_qp_list() 65 u16 *pkey, in get_pkey_and_subnet_prefix() argument 71 ret = ib_get_cached_pkey(dev, pp->port_num, pp->pkey_index, pkey); in get_pkey_and_subnet_prefix() 80 static int enforce_qp_pkey_security(u16 pkey, in enforce_qp_pkey_security() argument 87 ret = security_ib_pkey_access(qp_sec->security, subnet_prefix, pkey); in enforce_qp_pkey_security() 96 pkey); in enforce_qp_pkey_security() 115 u16 pkey; in check_qp_port_pkey_settings() local 123 &pkey, in check_qp_port_pkey_settings() [all …]
|
| /linux/tools/testing/selftests/powerpc/include/ |
| H A D | pkeys.h | 51 #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey + 1) * AMR_BITS_PER_PKEY)) argument 63 void pkey_set_rights(int pkey, unsigned long rights) in pkey_set_rights() argument 67 shift = (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY; in pkey_set_rights() 74 int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey) in sys_pkey_mprotect() argument 76 return syscall(__NR_pkey_mprotect, addr, len, prot, pkey); in sys_pkey_mprotect() 84 int sys_pkey_free(int pkey) in sys_pkey_free() argument 86 return syscall(__NR_pkey_free, pkey); in sys_pkey_free() 92 int pkey; in pkeys_unsupported() local 99 pkey = sys_pkey_alloc(0, PKEY_UNRESTRICTED); in pkeys_unsupported() 100 SKIP_IF(pkey < 0); in pkeys_unsupported() [all …]
|
| /linux/tools/testing/selftests/powerpc/mm/ |
| H A D | pkey_exec_prot.c | 106 int pkey, ret, i; in test() local 155 pkey = sys_pkey_alloc(0, rights); in test() 156 FAIL_IF(pkey < 0); in test() 179 FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0); in test() 196 FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0); in test() 205 fault_pkey = pkey; in test() 216 FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0); in test() 217 pkey_set_rights(pkey, rights); in test() 233 FAIL_IF(sys_pkey_mprotect(insns, pgsize, PROT_EXEC, pkey) != 0); in test() 234 pkey_set_rights(pkey, rights); in test() [all …]
|
| /linux/drivers/s390/crypto/ |
| H A D | Makefile | 17 pkey-objs := pkey_base.o pkey_api.o pkey_sysfs.o 18 obj-$(CONFIG_PKEY) += pkey.o 21 pkey-cca-objs := pkey_cca.o 22 obj-$(CONFIG_PKEY_CCA) += pkey-cca.o 25 pkey-ep11-objs := pkey_ep11.o 26 obj-$(CONFIG_PKEY_EP11) += pkey-ep11.o 29 pkey-pckmo-objs := pkey_pckmo.o 30 obj-$(CONFIG_PKEY_PCKMO) += pkey-pckmo.o 33 pkey-uv-objs := pkey_uv.o 34 obj-$(CONFIG_PKEY_UV) += pkey-uv.o
|
| /linux/arch/powerpc/mm/book3s64/ |
| H A D | pkeys.c | 49 #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey+1) * AMR_BITS_PER_PKEY)) argument 315 static inline void init_amr(int pkey, u8 init_bits) in init_amr() argument 317 u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey)); in init_amr() 318 u64 old_amr = current_thread_amr() & ~((u64)(0x3ul) << pkeyshift(pkey)); in init_amr() 323 static inline void init_iamr(int pkey, u8 init_bits) in init_iamr() argument 325 u64 new_iamr_bits = (((u64)init_bits & 0x1UL) << pkeyshift(pkey)); in init_iamr() 326 u64 old_iamr = current_thread_iamr() & ~((u64)(0x1ul) << pkeyshift(pkey)); in init_iamr() 338 int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, in __arch_set_user_pkey_access() argument 348 pkey_bits = 0x3ul << pkeyshift(pkey); in __arch_set_user_pkey_access() 362 init_iamr(pkey, new_iamr_bits); in __arch_set_user_pkey_access() [all …]
|
| /linux/drivers/infiniband/ulp/ipoib/ |
| H A D | ipoib_vlan.c | 72 if (ppriv->pkey == priv->pkey) in is_child_unique() 77 if (tpriv->pkey == priv->pkey && in is_child_unique() 98 u16 pkey, int type) in __ipoib_vlan_add() argument 116 if (pkey == 0 || pkey == 0x8000) { in __ipoib_vlan_add() 124 priv->pkey = pkey; in __ipoib_vlan_add() 168 int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) in ipoib_vlan_add() argument 193 pkey); in ipoib_vlan_add() 204 result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD); in ipoib_vlan_add() 252 int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) in ipoib_vlan_delete() argument 273 if (priv->pkey == pkey && in ipoib_vlan_delete()
|
| /linux/Documentation/translations/zh_CN/core-api/ |
| H A D | protection-keys.rst | 46 int pkey_free(int pkey); 48 unsigned long prot, int pkey); 50 在使用一个pkey之前,必须先用pkey_alloc()分配它。一个应用程序直接调用 55 pkey = pkey_alloc(0, PKEY_DISABLE_WRITE); 57 ret = pkey_mprotect(ptr, PAGE_SIZE, real_prot, pkey); 63 pkey_set(pkey, 0); // clear PKEY_DISABLE_WRITE 65 pkey_set(pkey, PKEY_DISABLE_WRITE); // set PKEY_DISABLE_WRITE again 67 现在,当它释放内存时,它也将释放pkey,因为它不再被使用了:: 70 pkey_free(pkey); 85 pkey = pkey_alloc(0, PKEY_DISABLE_WRITE | PKEY_DISABLE_READ); [all …]
|
| /linux/include/net/ |
| H A D | neighbour.h | 212 __u32 (*hash)(const void *pkey, 215 bool (*key_eq)(const struct neighbour *, const void *pkey); 220 int (*is_multicast)(const void *pkey); 287 static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey) in neigh_key_eq32() argument 289 return *(const u32 *)n->primary_key == *(const u32 *)pkey; in neigh_key_eq32() 292 static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey) in neigh_key_eq128() argument 295 const u32 *p32 = pkey; in neigh_key_eq128() 303 bool (*key_eq)(const struct neighbour *n, const void *pkey), in ___neigh_lookup_noref() argument 304 __u32 (*hash)(const void *pkey, in ___neigh_lookup_noref() argument 307 const void *pkey, in ___neigh_lookup_noref() [all …]
|
| /linux/arch/x86/mm/ |
| H A D | pkeys.c | 76 int __arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey) in __arch_override_mprotect_pkey() argument 82 if (pkey != -1) in __arch_override_mprotect_pkey() 83 return pkey; in __arch_override_mprotect_pkey() 92 pkey = execute_only_pkey(vma->vm_mm); in __arch_override_mprotect_pkey() 93 if (pkey > 0) in __arch_override_mprotect_pkey() 94 return pkey; in __arch_override_mprotect_pkey() 113 #define PKRU_AD_MASK(pkey) (PKRU_AD_BIT << ((pkey) * PKRU_BITS_PER_PKEY)) argument
|
| /linux/drivers/infiniband/hw/hfi1/ |
| H A D | ud.c | 70 u16 pkey; in ud_loopback() local 74 pkey = hfi1_get_pkey(ibp, sqp->s_pkey_index); in ud_loopback() 77 if (unlikely(ingress_pkey_check(ppd, pkey, sc5, in ud_loopback() 80 hfi1_bad_pkey(ibp, pkey, in ud_loopback() 226 u16 *pkey, u32 extra_bytes, bool bypass) in hfi1_make_bth_deth() argument 243 *pkey = hfi1_get_pkey(ibp, rvt_get_swqe_pkey_index(wqe)); in hfi1_make_bth_deth() 245 *pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); in hfi1_make_bth_deth() 247 bth0 |= *pkey; in hfi1_make_bth_deth() 265 u16 len, slid, dlid, pkey; in hfi1_make_ud_req_9B() local 323 hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, false); in hfi1_make_ud_req_9B() [all …]
|
| /linux/include/linux/ |
| H A D | pkeys.h | 14 #define arch_override_mprotect_pkey(vma, prot, pkey) (0) argument 23 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) in mm_pkey_is_allocated() argument 25 return (pkey == 0); in mm_pkey_is_allocated() 33 static inline int mm_pkey_free(struct mm_struct *mm, int pkey) in mm_pkey_free() argument 38 static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, in arch_set_user_pkey_access() argument
|
| /linux/lib/ |
| H A D | digsig.c | 74 MPI in = NULL, res = NULL, pkey[2]; in digsig_verify_rsa() local 108 pkey[i] = mpi_read_from_buffer(datap, &remaining); in digsig_verify_rsa() 109 if (IS_ERR(pkey[i])) { in digsig_verify_rsa() 110 err = PTR_ERR(pkey[i]); in digsig_verify_rsa() 116 mblen = mpi_get_nbits(pkey[0]); in digsig_verify_rsa() 141 err = mpi_powm(res, in, pkey[1], pkey[0]); in digsig_verify_rsa() 172 mpi_free(pkey[i]); in digsig_verify_rsa()
|