/kernel/linux/linux-5.10/arch/powerpc/include/asm/ |
D | pkeys.h | 33 static inline u64 pkey_to_vmflag_bits(u16 pkey) in pkey_to_vmflag_bits() argument 35 return (((u64)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 …]
|
D | mman.h | 17 unsigned long pkey) in arch_calc_vm_prot_bits() argument 20 return (((prot & PROT_SAO) ? VM_SAO : 0) | pkey_to_vmflag_bits(pkey)); in arch_calc_vm_prot_bits() 25 #define arch_calc_vm_prot_bits(prot, pkey) arch_calc_vm_prot_bits(prot, pkey) argument
|
/kernel/linux/linux-5.10/tools/testing/selftests/vm/ |
D | protection_keys.c | 177 static u32 hw_pkey_get(int pkey, unsigned long flags) in hw_pkey_get() argument 182 __func__, pkey, flags, 0, 0); in hw_pkey_get() 185 return (u32) get_pkey_bits(pkey_reg, pkey); in hw_pkey_get() 188 static int hw_pkey_set(int pkey, unsigned long rights, unsigned long flags) in hw_pkey_set() argument 198 new_pkey_reg = set_pkey_bits(old_pkey_reg, pkey, rights); in hw_pkey_set() 204 __func__, pkey, rights, flags, 0, __read_pkey_reg(), in hw_pkey_set() 209 void pkey_disable_set(int pkey, int flags) in pkey_disable_set() argument 217 pkey, flags); in pkey_disable_set() 220 pkey_rights = hw_pkey_get(pkey, syscall_flags); in pkey_disable_set() 223 pkey, pkey, pkey_rights); in pkey_disable_set() [all …]
|
D | pkey-powerpc.h | 37 static inline u32 pkey_bit_position(int pkey) in pkey_bit_position() argument 39 return (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY; in pkey_bit_position() 94 void expect_fault_on_read_execonly_key(void *p1, int pkey) in expect_fault_on_read_execonly_key() argument 108 void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) in malloc_pkey_with_mprotect_subpage() argument 114 size, prot, pkey); in malloc_pkey_with_mprotect_subpage() 115 pkey_assert(pkey < NR_PKEYS); in malloc_pkey_with_mprotect_subpage() 125 ret = mprotect_pkey((void *)ptr, PAGE_SIZE, prot, pkey); in malloc_pkey_with_mprotect_subpage() 129 dprintf1("%s() for pkey %d @ %p\n", __func__, pkey, ptr); in malloc_pkey_with_mprotect_subpage()
|
D | pkey-helpers.h | 81 void expected_pkey_fault(int pkey); 83 int sys_pkey_free(unsigned long pkey); 85 unsigned long pkey); 98 static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags) in set_pkey_bits() argument 100 u32 shift = pkey_bit_position(pkey); in set_pkey_bits() 108 static inline u64 get_pkey_bits(u64 reg, int pkey) in get_pkey_bits() argument 110 u32 shift = pkey_bit_position(pkey); in get_pkey_bits() 150 static inline void __pkey_access_allow(int pkey, int do_allow) in __pkey_access_allow() argument 153 int bit = pkey * 2; in __pkey_access_allow() 164 static inline void __pkey_write_allow(int pkey, int do_allow_write) in __pkey_write_allow() argument [all …]
|
D | pkey-x86.h | 122 static inline u32 pkey_bit_position(int pkey) in pkey_bit_position() argument 124 return pkey * PKEY_BITS_PER_PKEY; in pkey_bit_position() 167 void expect_fault_on_read_execonly_key(void *p1, int pkey) in expect_fault_on_read_execonly_key() argument 173 expected_pkey_fault(pkey); in expect_fault_on_read_execonly_key() 176 void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) in malloc_pkey_with_mprotect_subpage() argument
|
/kernel/linux/linux-5.10/crypto/asymmetric_keys/ |
D | public_key.c | 68 software_key_determine_akcipher(const struct public_key *pkey, in software_key_determine_akcipher() argument 77 if (strcmp(pkey->pkey_algo, "rsa") == 0) { in software_key_determine_akcipher() 85 pkey->pkey_algo); in software_key_determine_akcipher() 89 pkey->pkey_algo, hash_algo); in software_key_determine_akcipher() 100 } else if (strncmp(pkey->pkey_algo, "ecdsa", 5) == 0) { in software_key_determine_akcipher() 118 } else if (strcmp(pkey->pkey_algo, "sm2") == 0) { in software_key_determine_akcipher() 125 } else if (strcmp(pkey->pkey_algo, "ecrdsa") == 0) { in software_key_determine_akcipher() 137 if (strscpy(alg_name, pkey->pkey_algo, CRYPTO_MAX_ALG_NAME) < 0) in software_key_determine_akcipher() 155 struct public_key *pkey = params->key->payload.data[asym_crypto]; in software_key_query() local 160 ret = software_key_determine_akcipher(pkey, params->encoding, in software_key_query() [all …]
|
/kernel/linux/linux-5.10/security/selinux/ |
D | ibpkey.c | 56 static unsigned int sel_ib_pkey_hashfn(u16 pkey) in sel_ib_pkey_hashfn() argument 58 return (pkey & (SEL_PKEY_HASH_SIZE - 1)); in sel_ib_pkey_hashfn() 74 struct sel_ib_pkey *pkey; in sel_ib_pkey_find() local 77 list_for_each_entry_rcu(pkey, &sel_ib_pkey_hash[idx].list, list) { in sel_ib_pkey_find() 78 if (pkey->psec.pkey == pkey_num && in sel_ib_pkey_find() 79 pkey->psec.subnet_prefix == subnet_prefix) in sel_ib_pkey_find() 80 return pkey; in sel_ib_pkey_find() 94 static void sel_ib_pkey_insert(struct sel_ib_pkey *pkey) in sel_ib_pkey_insert() argument 101 idx = sel_ib_pkey_hashfn(pkey->psec.pkey); in sel_ib_pkey_insert() 102 list_add_rcu(&pkey->list, &sel_ib_pkey_hash[idx].list); in sel_ib_pkey_insert() [all …]
|
/kernel/linux/linux-5.10/arch/x86/include/asm/ |
D | pkeys.h | 14 extern int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, 36 int prot, int pkey); 38 int prot, int pkey) in arch_override_mprotect_pkey() argument 43 return __arch_override_mprotect_pkey(vma, prot, pkey); in arch_override_mprotect_pkey() 46 extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, 52 #define mm_set_pkey_allocated(mm, pkey) do { \ argument 53 mm_pkey_allocation_map(mm) |= (1U << pkey); \ 55 #define mm_set_pkey_free(mm, pkey) do { \ argument 56 mm_pkey_allocation_map(mm) &= ~(1U << pkey); \ 60 bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) in mm_pkey_is_allocated() argument [all …]
|
/kernel/linux/linux-5.10/drivers/infiniband/core/ |
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 …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/powerpc/mm/ |
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 …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/powerpc/include/ |
D | pkeys.h | 52 void pkey_set_rights(int pkey, unsigned long rights) in pkey_set_rights() argument 56 shift = (NR_PKEYS - pkey - 1) * PKEY_BITS_PER_PKEY; in pkey_set_rights() 63 int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey) in sys_pkey_mprotect() argument 65 return syscall(__NR_pkey_mprotect, addr, len, prot, pkey); in sys_pkey_mprotect() 73 int sys_pkey_free(int pkey) in sys_pkey_free() argument 75 return syscall(__NR_pkey_free, pkey); in sys_pkey_free() 81 int pkey; in pkeys_unsupported() local 88 pkey = sys_pkey_alloc(0, 0); in pkeys_unsupported() 89 SKIP_IF(pkey < 0); in pkeys_unsupported() 90 sys_pkey_free(pkey); in pkeys_unsupported()
|
/kernel/linux/linux-5.10/arch/powerpc/mm/book3s64/ |
D | pkeys.c | 44 #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey+1) * AMR_BITS_PER_PKEY)) argument 260 static inline void init_amr(int pkey, u8 init_bits) in init_amr() argument 262 u64 new_amr_bits = (((u64)init_bits & 0x3UL) << pkeyshift(pkey)); in init_amr() 263 u64 old_amr = read_amr() & ~((u64)(0x3ul) << pkeyshift(pkey)); in init_amr() 268 static inline void init_iamr(int pkey, u8 init_bits) in init_iamr() argument 270 u64 new_iamr_bits = (((u64)init_bits & 0x1UL) << pkeyshift(pkey)); in init_iamr() 271 u64 old_iamr = read_iamr() & ~((u64)(0x1ul) << pkeyshift(pkey)); in init_iamr() 280 int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey, in __arch_set_user_pkey_access() argument 290 pkey_bits = 0x3ul << pkeyshift(pkey); in __arch_set_user_pkey_access() 304 init_iamr(pkey, new_iamr_bits); in __arch_set_user_pkey_access() [all …]
|
/kernel/linux/linux-5.10/drivers/infiniband/ulp/ipoib/ |
D | ipoib_vlan.c | 74 if (ppriv->pkey == priv->pkey) in is_child_unique() 78 if (tpriv->pkey == priv->pkey && in is_child_unique() 96 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 189 ppriv->dev->name, pkey); in ipoib_vlan_add() 200 result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD); in ipoib_vlan_add() 248 int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) in ipoib_vlan_delete() argument 268 if (priv->pkey == pkey && in ipoib_vlan_delete()
|
/kernel/linux/common_modules/newip/third_party/linux-5.10/include/net/ |
D | nndisc.h | 28 static inline bool neigh_key_eq800(const struct neighbour *n, const void *pkey) in neigh_key_eq800() argument 32 a1 = (struct nip_addr *)(pkey); in neigh_key_eq800() 40 static inline u32 nndisc_hashfn(const void *pkey, const struct net_device *dev, in nndisc_hashfn() argument 43 return (*(int *)pkey % NEWIP_NEIGH_BUCKET_MAX); in nndisc_hashfn() 47 const void *pkey) in __nip_neigh_lookup_noref() argument 50 pkey, dev); in __nip_neigh_lookup_noref() 54 const void *pkey) in __nip_neigh_lookup() argument 59 n = __nip_neigh_lookup_noref(dev, pkey); in __nip_neigh_lookup()
|
/kernel/linux/linux-5.10/include/net/ |
D | neighbour.h | 199 __u32 (*hash)(const void *pkey, 202 bool (*key_eq)(const struct neighbour *, const void *pkey); 207 int (*is_multicast)(const void *pkey); 266 static inline bool neigh_key_eq16(const struct neighbour *n, const void *pkey) in neigh_key_eq16() argument 268 return *(const u16 *)n->primary_key == *(const u16 *)pkey; in neigh_key_eq16() 271 static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey) in neigh_key_eq32() argument 273 return *(const u32 *)n->primary_key == *(const u32 *)pkey; in neigh_key_eq32() 276 static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey) in neigh_key_eq128() argument 279 const u32 *p32 = pkey; in neigh_key_eq128() 287 bool (*key_eq)(const struct neighbour *n, const void *pkey), in ___neigh_lookup_noref() argument [all …]
|
D | ndisc.h | 371 static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd) in ndisc_hashfn() argument 373 const u32 *p32 = pkey; in ndisc_hashfn() 381 static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) in __ipv6_neigh_lookup_noref() argument 383 return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev); in __ipv6_neigh_lookup_noref() 388 const void *pkey) in __ipv6_neigh_lookup_noref_stub() argument 391 ndisc_hashfn, pkey, dev); in __ipv6_neigh_lookup_noref_stub() 394 static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey) in __ipv6_neigh_lookup() argument 399 n = __ipv6_neigh_lookup_noref(dev, pkey); in __ipv6_neigh_lookup() 408 const void *pkey) in __ipv6_confirm_neigh() argument 413 n = __ipv6_neigh_lookup_noref(dev, pkey); in __ipv6_confirm_neigh() [all …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/powerpc/ptrace/ |
D | Makefile | 4 ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak ptrace-pkey core-pkey \ 12 $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: child.h 13 $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
|
/kernel/linux/linux-5.10/crypto/ |
D | rsa.c | 57 const struct rsa_mpi_key *pkey = rsa_get_key(tfm); in rsa_enc() local 65 if (unlikely(!pkey->n || !pkey->e)) { in rsa_enc() 75 ret = _rsa_enc(pkey, c, m); in rsa_enc() 96 const struct rsa_mpi_key *pkey = rsa_get_key(tfm); in rsa_dec() local 104 if (unlikely(!pkey->n || !pkey->d)) { in rsa_dec() 114 ret = _rsa_dec(pkey, m, c); in rsa_dec() 230 struct rsa_mpi_key *pkey = akcipher_tfm_ctx(tfm); in rsa_max_size() local 232 return mpi_get_size(pkey->n); in rsa_max_size() 237 struct rsa_mpi_key *pkey = akcipher_tfm_ctx(tfm); in rsa_exit_tfm() local 239 rsa_free_mpi_key(pkey); in rsa_exit_tfm()
|
/kernel/linux/linux-5.10/include/linux/ |
D | pkeys.h | 12 #define arch_override_mprotect_pkey(vma, prot, pkey) (0) argument 21 static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) in mm_pkey_is_allocated() argument 23 return (pkey == 0); in mm_pkey_is_allocated() 31 static inline int mm_pkey_free(struct mm_struct *mm, int pkey) in mm_pkey_free() argument 36 static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, in arch_set_user_pkey_access() argument
|
/kernel/linux/linux-5.10/arch/x86/mm/ |
D | pkeys.c | 77 int __arch_override_mprotect_pkey(struct vm_area_struct *vma, int prot, int pkey) in __arch_override_mprotect_pkey() argument 83 if (pkey != -1) in __arch_override_mprotect_pkey() 84 return pkey; in __arch_override_mprotect_pkey() 93 pkey = execute_only_pkey(vma->vm_mm); in __arch_override_mprotect_pkey() 94 if (pkey > 0) in __arch_override_mprotect_pkey() 95 return pkey; in __arch_override_mprotect_pkey() 114 #define PKRU_AD_KEY(pkey) (PKRU_AD_BIT << ((pkey) * PKRU_BITS_PER_PKEY)) argument
|
/kernel/linux/linux-5.10/drivers/infiniband/hw/hfi1/ |
D | ud.c | 112 u16 pkey; in ud_loopback() local 116 pkey = hfi1_get_pkey(ibp, sqp->s_pkey_index); in ud_loopback() 119 if (unlikely(ingress_pkey_check(ppd, pkey, sc5, in ud_loopback() 122 hfi1_bad_pkey(ibp, pkey, in ud_loopback() 268 u16 *pkey, u32 extra_bytes, bool bypass) in hfi1_make_bth_deth() argument 285 *pkey = hfi1_get_pkey(ibp, rvt_get_swqe_pkey_index(wqe)); in hfi1_make_bth_deth() 287 *pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); in hfi1_make_bth_deth() 289 bth0 |= *pkey; in hfi1_make_bth_deth() 307 u16 len, slid, dlid, pkey; in hfi1_make_ud_req_9B() local 365 hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, false); in hfi1_make_ud_req_9B() [all …]
|
D | trace_ibhdrs.h | 118 u16 *pkey, u32 *psn, u32 *qpn); 129 u16 *entropy, u16 *len, u16 *pkey, 136 u16 len, u16 pkey, u32 dlid, u32 slid); 141 u8 tver, u16 pkey, u32 psn, u32 qpn, 181 __field(u16, pkey) 209 &__entry->pkey, 248 &__entry->pkey, 279 __entry->pkey, 295 __entry->pkey, 340 __field(u16, pkey) [all …]
|
/kernel/linux/linux-5.10/Documentation/core-api/ |
D | protection-keys.rst | 39 int pkey_free(int pkey); 41 unsigned long prot, int pkey); 43 Before a pkey can be used, it must first be allocated with 51 pkey = pkey_alloc(0, PKEY_DISABLE_WRITE); 53 ret = pkey_mprotect(ptr, PAGE_SIZE, real_prot, pkey); 59 pkey_set(pkey, 0); // clear PKEY_DISABLE_WRITE 61 pkey_set(pkey, PKEY_DISABLE_WRITE); // set PKEY_DISABLE_WRITE again 63 Now when it frees the memory, it will also free the pkey since it 67 pkey_free(pkey); 84 pkey = pkey_alloc(0, PKEY_DISABLE_WRITE | PKEY_DISABLE_READ); [all …]
|
/kernel/linux/linux-5.10/lib/ |
D | digsig.c | 78 MPI in = NULL, res = NULL, pkey[2]; in digsig_verify_rsa() local 112 pkey[i] = mpi_read_from_buffer(datap, &remaining); in digsig_verify_rsa() 113 if (IS_ERR(pkey[i])) { in digsig_verify_rsa() 114 err = PTR_ERR(pkey[i]); in digsig_verify_rsa() 120 mblen = mpi_get_nbits(pkey[0]); in digsig_verify_rsa() 145 err = mpi_powm(res, in, pkey[1], pkey[0]); in digsig_verify_rsa() 177 mpi_free(pkey[i]); in digsig_verify_rsa()
|