/linux/arch/powerpc/include/asm/ |
A D | pkeys.h | 50 #define pkey_alloc_mask(pkey) (0x1 << pkey) argument 58 #define __mm_pkey_free(mm, pkey) { \ argument 66 pkey_alloc_mask(pkey)) 70 if (pkey < 0 || pkey >= arch_max_pkey()) in mm_pkey_is_allocated() 74 if (__mm_pkey_is_reserved(pkey)) in mm_pkey_is_allocated() 118 __mm_pkey_free(mm, pkey); in mm_pkey_free() 129 int prot, int pkey); 131 int prot, int pkey) in arch_override_mprotect_pkey() argument 140 if (pkey != -1) in arch_override_mprotect_pkey() 141 return pkey; in arch_override_mprotect_pkey() [all …]
|
A 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
|
/linux/tools/testing/selftests/vm/ |
A D | protection_keys.c | 217 pkey, flags); in pkey_disable_set() 223 pkey, pkey, pkey_rights); in pkey_disable_set() 240 pkey, pkey, pkey_rights); in pkey_disable_set() 247 pkey, flags); in pkey_disable_set() 260 pkey, pkey, pkey_rights); in pkey_disable_clear() 271 pkey, pkey, pkey_rights); in pkey_disable_clear() 1046 u16 pkey) in test_read_of_access_disabled_region_with_page_already_mapped() argument 1051 pkey, ptr); in test_read_of_access_disabled_region_with_page_already_mapped() 1063 u16 pkey) in test_write_of_write_disabled_region_with_page_already_mapped() argument 1089 u16 pkey) in test_write_of_access_disabled_region_with_page_already_mapped() argument [all …]
|
A 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 …]
|
A 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()
|
A 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() 168 void expect_fault_on_read_execonly_key(void *p1, int pkey) in expect_fault_on_read_execonly_key() argument 174 expected_pkey_fault(pkey); in expect_fault_on_read_execonly_key() 177 void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) in malloc_pkey_with_mprotect_subpage() argument
|
/linux/crypto/asymmetric_keys/ |
A D | public_key.c | 81 pkey->pkey_algo); in software_key_determine_akcipher() 127 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in software_key_query() 131 memcpy(key, pkey->key, pkey->keylen); in software_key_query() 135 memcpy(ptr, pkey->params, pkey->paramlen); in software_key_query() 197 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in software_key_eds_op() 202 memcpy(key, pkey->key, pkey->keylen); in software_key_eds_op() 206 memcpy(ptr, pkey->params, pkey->paramlen); in software_key_eds_op() 324 BUG_ON(!pkey); in public_key_verify_signature() 343 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in public_key_verify_signature() 348 memcpy(key, pkey->key, pkey->keylen); in public_key_verify_signature() [all …]
|
/linux/security/selinux/ |
A D | ibpkey.c | 73 struct sel_ib_pkey *pkey; in sel_ib_pkey_find() local 77 if (pkey->psec.pkey == pkey_num && in sel_ib_pkey_find() 79 return pkey; in sel_ib_pkey_find() 100 idx = sel_ib_pkey_hashfn(pkey->psec.pkey); in sel_ib_pkey_insert() 132 struct sel_ib_pkey *pkey; in sel_ib_pkey_sid_slow() local 138 if (pkey) { in sel_ib_pkey_sid_slow() 139 *sid = pkey->psec.sid; in sel_ib_pkey_sid_slow() 183 struct sel_ib_pkey *pkey; in sel_ib_pkey_sid() local 187 if (pkey) { in sel_ib_pkey_sid() 188 *sid = pkey->psec.sid; in sel_ib_pkey_sid() [all …]
|
/linux/arch/x86/include/asm/ |
A D | pkeys.h | 34 int prot, int pkey); 36 int prot, int pkey) in arch_override_mprotect_pkey() argument 50 #define mm_set_pkey_allocated(mm, pkey) do { \ argument 51 mm_pkey_allocation_map(mm) |= (1U << pkey); \ 53 #define mm_set_pkey_free(mm, pkey) do { \ argument 54 mm_pkey_allocation_map(mm) &= ~(1U << pkey); \ 65 if (pkey < 0) in mm_pkey_is_allocated() 67 if (pkey >= arch_max_pkey()) in mm_pkey_is_allocated() 74 if (pkey == mm->context.execute_only_pkey) in mm_pkey_is_allocated() 113 if (!mm_pkey_is_allocated(mm, pkey)) in mm_pkey_free() [all …]
|
A D | pkru.h | 19 static inline bool __pkru_allows_read(u32 pkru, u16 pkey) in __pkru_allows_read() argument 21 int pkru_pkey_bits = pkey * PKRU_BITS_PER_PKEY; in __pkru_allows_read() 25 static inline bool __pkru_allows_write(u32 pkru, u16 pkey) in __pkru_allows_write() argument 27 int pkru_pkey_bits = pkey * PKRU_BITS_PER_PKEY; in __pkru_allows_write()
|
/linux/drivers/infiniband/core/ |
A D | security.c | 61 return pkey; in get_pkey_idx_qp_list() 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() 137 &pkey, in check_qp_port_pkey_settings() 258 if (!pkey) { in port_pkey_list_insert() 261 pkey = kzalloc(sizeof(*pkey), GFP_KERNEL); in port_pkey_list_insert() 262 if (!pkey) in port_pkey_list_insert() 273 kfree(pkey); in port_pkey_list_insert() 566 kfree(pkey); in ib_security_release_port_pkey_list() [all …]
|
/linux/tools/testing/selftests/powerpc/mm/ |
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() 205 fault_pkey = pkey; in test() 217 pkey_set_rights(pkey, rights); in test() 234 pkey_set_rights(pkey, rights); in test() 241 sys_pkey_free(pkey); in test() 249 pkey = sys_pkey_alloc(0, rights); in test() 250 FAIL_IF(pkey < 0); in test() 262 fault_pkey = pkey; in test() [all …]
|
/linux/arch/powerpc/mm/book3s64/ |
A D | pkeys.c | 48 #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey+1) * AMR_BITS_PER_PKEY)) argument 313 static inline void init_amr(int pkey, u8 init_bits) in init_amr() argument 321 static inline void init_iamr(int pkey, u8 init_bits) in init_iamr() argument 346 pkey_bits = 0x3ul << pkeyshift(pkey); in __arch_set_user_pkey_access() 360 init_iamr(pkey, new_iamr_bits); in __arch_set_user_pkey_access() 368 init_amr(pkey, new_amr_bits); in __arch_set_user_pkey_access() 390 int pkey) in __arch_override_mprotect_pkey() argument 404 pkey = execute_only_pkey(vma->vm_mm); in __arch_override_mprotect_pkey() 405 if (pkey > 0) in __arch_override_mprotect_pkey() 406 return pkey; in __arch_override_mprotect_pkey() [all …]
|
/linux/drivers/infiniband/ulp/ipoib/ |
A 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()
|
/linux/Documentation/translations/zh_CN/core-api/ |
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/tools/testing/selftests/powerpc/include/ |
A 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()
|
/linux/include/net/ |
A D | neighbour.h | 200 __u32 (*hash)(const void *pkey, 208 int (*is_multicast)(const void *pkey); 287 const u32 *p32 = pkey; in neigh_key_eq128() 296 __u32 (*hash)(const void *pkey, in ___neigh_lookup_noref() argument 299 const void *pkey, in ___neigh_lookup_noref() 310 if (n->dev == dev && key_eq(n, pkey)) in ___neigh_lookup_noref() 318 const void *pkey, in __neigh_lookup_noref() argument 329 const void *pkey); 333 const void *pkey, in neigh_create() argument 538 n = neigh_create(tbl, pkey, dev); in __neigh_lookup() [all …]
|
A 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() 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() 425 const void *pkey) in __ipv6_confirm_neigh_stub() argument [all …]
|
/linux/crypto/ |
A 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()
|
/linux/drivers/infiniband/hw/hfi1/ |
A D | ud.c | 70 u16 pkey; in ud_loopback() local 80 hfi1_bad_pkey(ibp, pkey, in ud_loopback() 247 bth0 |= *pkey; in hfi1_make_bth_deth() 265 u16 len, slid, dlid, pkey; in hfi1_make_ud_req_9B() local 343 u16 len, pkey; in hfi1_make_ud_req_16B() local 560 if (pkey == FULL_MGMT_P_KEY || pkey == LIM_MGMT_P_KEY) { in hfi1_lookup_pkey_idx() 565 if (ppd->pkeys[i] == pkey) in hfi1_lookup_pkey_idx() 572 if (pkey == FULL_MGMT_P_KEY) in hfi1_lookup_pkey_idx() 780 if (pkey != FULL_MGMT_P_KEY) { in opa_smp_check() 813 u16 pkey; in hfi1_ud_rcv() local [all …]
|
/linux/arch/x86/mm/ |
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_KEY(pkey) (PKRU_AD_BIT << ((pkey) * PKRU_BITS_PER_PKEY)) argument
|
/linux/tools/testing/selftests/powerpc/ptrace/ |
A 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
|
/linux/include/linux/ |
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/Documentation/core-api/ |
A 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 …]
|
/linux/lib/ |
A 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()
|