| /linux/security/selinux/ |
| H A D | ibpkey.c | 48 * sel_ib_pkey_hashfn - Hashing function for the pkey table 49 * @pkey: pkey number 52 * This is the hashing function for the pkey table, it returns the bucket 53 * number for the given pkey. 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() 62 * sel_ib_pkey_find - Search for a pkey record 67 * Search the pkey table and return the matching record. If an entry 74 struct sel_ib_pkey *pkey; in sel_ib_pkey_find() local 94 sel_ib_pkey_insert(struct sel_ib_pkey * pkey) sel_ib_pkey_insert() argument 133 struct sel_ib_pkey *pkey; sel_ib_pkey_sid_slow() local 183 struct sel_ib_pkey *pkey; sel_ib_pkey_sid() local 207 struct sel_ib_pkey *pkey, *pkey_tmp; sel_ib_pkey_flush() local [all...] |
| /linux/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 50 #include "pkey-helpers.h" 99 static u32 hw_pkey_get(int pkey, unsigned long flags) in tracing_root_ok() 103 dprintf1("%s(pkey=%d, flags=%lx) = %x / %d\n", 104 __func__, pkey, flags, 0, 0); in tracing_on() 107 return (u32) get_pkey_bits(pkey_reg, pkey); in tracing_on() 110 static int hw_pkey_set(int pkey, unsigne in tracing_on() 184 hw_pkey_get(int pkey,unsigned long flags) hw_pkey_get() argument 195 hw_pkey_set(int pkey,unsigned long rights,unsigned long flags) hw_pkey_set() argument 216 pkey_disable_set(int pkey,int flags) pkey_disable_set() argument 254 pkey_disable_clear(int pkey,int flags) pkey_disable_clear() argument 280 pkey_write_allow(int pkey) pkey_write_allow() argument 284 pkey_write_deny(int pkey) pkey_write_deny() argument 288 pkey_access_allow(int pkey) pkey_access_allow() argument 292 pkey_access_deny(int pkey) pkey_access_deny() argument 555 mprotect_pkey(void * ptr,size_t size,unsigned long orig_prot,unsigned long pkey) mprotect_pkey() argument 660 malloc_pkey_with_mprotect(long size,int prot,u16 pkey) malloc_pkey_with_mprotect() argument 680 malloc_pkey_anon_huge(long size,int prot,u16 pkey) malloc_pkey_anon_huge() argument 761 malloc_pkey_hugetlb(long size,int prot,u16 pkey) malloc_pkey_hugetlb() argument 790 malloc_pkey(long size,int prot,u16 pkey) malloc_pkey() argument 822 expected_pkey_fault(int pkey) expected_pkey_fault() argument 892 test_pkey_alloc_free_attach_pkey0(int * ptr,u16 pkey) test_pkey_alloc_free_attach_pkey0() argument 944 test_read_of_write_disabled_region(int * ptr,u16 pkey) test_read_of_write_disabled_region() argument 954 test_read_of_access_disabled_region(int * ptr,u16 pkey) test_read_of_access_disabled_region() argument 967 test_read_of_access_disabled_region_with_page_already_mapped(int * ptr,u16 pkey) test_read_of_access_disabled_region_with_page_already_mapped() argument 984 test_write_of_write_disabled_region_with_page_already_mapped(int * ptr,u16 pkey) test_write_of_write_disabled_region_with_page_already_mapped() argument 994 test_write_of_write_disabled_region(int * ptr,u16 pkey) test_write_of_write_disabled_region() argument 1001 test_write_of_access_disabled_region(int * ptr,u16 pkey) test_write_of_access_disabled_region() argument 1010 test_write_of_access_disabled_region_with_page_already_mapped(int * ptr,u16 pkey) test_write_of_access_disabled_region_with_page_already_mapped() argument 1020 test_kernel_write_of_access_disabled_region(int * ptr,u16 pkey) test_kernel_write_of_access_disabled_region() argument 1033 test_kernel_write_of_write_disabled_region(int * ptr,u16 pkey) test_kernel_write_of_write_disabled_region() argument 1046 test_kernel_gup_of_access_disabled_region(int * ptr,u16 pkey) test_kernel_gup_of_access_disabled_region() argument 1068 test_kernel_gup_write_to_write_disabled_region(int * ptr,u16 pkey) test_kernel_gup_write_to_write_disabled_region() argument 1086 test_pkey_syscalls_on_non_allocated_pkey(int * ptr,u16 pkey) test_pkey_syscalls_on_non_allocated_pkey() argument 1109 test_pkey_syscalls_bad_args(int * ptr,u16 pkey) test_pkey_syscalls_bad_args() argument 1135 test_pkey_alloc_exhaust(int * ptr,u16 pkey) test_pkey_alloc_exhaust() argument 1241 test_pkey_init_state(int * ptr,u16 pkey) test_pkey_init_state() argument 1279 test_mprotect_with_pkey_0(int * ptr,u16 pkey) test_mprotect_with_pkey_0() argument 1303 test_ptrace_of_child(int * ptr,u16 pkey) test_ptrace_of_child() argument 1400 test_executing_on_unreadable_memory(int * ptr,u16 pkey) test_executing_on_unreadable_memory() argument 1432 test_implicit_mprotect_exec_only_memory(int * ptr,u16 pkey) test_implicit_mprotect_exec_only_memory() argument 1481 test_ptrace_modifies_pkru(int * ptr,u16 pkey) test_ptrace_modifies_pkru() argument 1604 test_ptrace_modifies_pkru(int * ptr,u16 pkey) test_ptrace_modifies_pkru() argument 1681 test_mprotect_pkey_on_unsupported_cpu(int * ptr,u16 pkey) test_mprotect_pkey_on_unsupported_cpu() argument 1727 int pkey; run_tests_once() local [all...] |
| H A D | pkey_util.c | 9 #include "pkey-helpers.h" in sys_pkey_alloc() 106 int sys_pkey_free(unsigned long pkey) 108 int ret = syscall(SYS_pkey_free, pkey); 109 dprintf1("%s(pkey=%ld) syscall ret: %d\n", __func__, pkey, ret); 114 unsigned long pkey) 118 dprintf2("%s(0x%p, %zx, prot=%lx, pkey=%lx)\n", __func__, 119 ptr, size, orig_prot, pkey); 122 sret = syscall(__NR_pkey_mprotect, ptr, size, orig_prot, pkey); 16 sys_pkey_free(unsigned long pkey) sys_pkey_free() argument 24 sys_mprotect_pkey(void * ptr,size_t size,unsigned long orig_prot,unsigned long pkey) sys_mprotect_pkey() argument
|
| H A D | pkey-powerpc.h | 28 #define NR_RESERVED_PKEYS_4K 27 /* pkey-0, pkey-1, exec-only-pkey 31 #define NR_RESERVED_PKEYS_64K_3KEYS 3 /* PowerNV and KVM: pkey-0, 32 pkey-1 and exec-only key */ 33 #define NR_RESERVED_PKEYS_64K_4KEYS 4 /* PowerVM: pkey-0, pkey-1, 34 pkey-31 and exec-only key */ 39 static inline u32 pkey_bit_position(int pkey) in pkey_bit_position() argument 41 return (NR_PKEYS - pkey in pkey_bit_position() 96 expect_fault_on_read_execonly_key(void * p1,int pkey) expect_fault_on_read_execonly_key() argument 120 malloc_pkey_with_mprotect_subpage(long size,int prot,u16 pkey) malloc_pkey_with_mprotect_subpage() argument [all...] |
| H A D | pkey-helpers.h | 92 int sys_pkey_free(unsigned long pkey); 94 unsigned long pkey); 98 void expected_pkey_fault(int pkey); 100 unsigned long pkey); 104 #include "pkey-x86.h" 106 #include "pkey-powerpc.h" 108 #include "pkey-arm64.h" 125 static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags) in set_pkey_bits() 127 u32 shift = pkey_bit_position(pkey); in set_pkey_bits() 128 /* mask out bits from pkey i in set_pkey_bits() 122 set_pkey_bits(u64 reg,int pkey,u64 flags) set_pkey_bits() argument 134 get_pkey_bits(u64 reg,int pkey) get_pkey_bits() argument [all...] |
| H A D | pkey_sighandler_tests.c | 6 * using an alternate signal stack, with the default pkey (pkey 0) disabled. 30 #include "pkey-helpers.h" 99 * Returns the most restrictive pkey register value that can be used by the 105 * Disallow everything except execution on pkey 0, so that each caller in pkey_reg_restrictive_default() 107 * its code mapped with pkey 0). in pkey_reg_restrictive_default() 200 * Verify that the sigsegv handler is invoked when pkey 0 is disabled. 241 * Verify that the sigsegv handler is invoked when pkey 0 is disabled. 292 int pkey; in test_sigsegv_handler_with_different_pkey_for_stack() 317 pkey in test_sigsegv_handler_with_different_pkey_for_stack() 287 int pkey; test_sigsegv_handler_with_different_pkey_for_stack() local 443 int pkey; test_pkru_sigreturn() local [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/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/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/crypto/asymmetric_keys/ |
| H A D | restrict.c | 138 const struct public_key *pkey; in restrict_link_by_ca() local 143 pkey = payload->data[asym_crypto]; in restrict_link_by_ca() 144 if (!pkey) in restrict_link_by_ca() 146 if (!test_bit(KEY_EFLAG_CA, &pkey->key_eflags)) in restrict_link_by_ca() 148 if (!test_bit(KEY_EFLAG_KEYCERTSIGN, &pkey->key_eflags)) in restrict_link_by_ca() 152 if (test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) in restrict_link_by_ca() 179 const struct public_key *pkey; in restrict_link_by_digsig() local 184 pkey = payload->data[asym_crypto]; in restrict_link_by_digsig() 186 if (!pkey) in restrict_link_by_digsig() 189 if (!test_bit(KEY_EFLAG_DIGITALSIG, &pkey->key_eflags)) in restrict_link_by_digsig() [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/include/net/ |
| H A D | neighbour.h | 214 __u32 (*hash)(const void *pkey, 217 bool (*key_eq)(const struct neighbour *, const void *pkey); 222 int (*is_multicast)(const void *pkey); 289 static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey) in neigh_key_eq32() argument 291 return *(const u32 *)n->primary_key == *(const u32 *)pkey; in neigh_key_eq32() 294 static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey) in neigh_key_eq128() argument 297 const u32 *p32 = pkey; in neigh_key_eq128() 305 bool (*key_eq)(const struct neighbour *n, const void *pkey), in ___neigh_lookup_noref() argument 306 __u32 (*hash)(const void *pkey, in ___neigh_lookup_noref() argument 309 const void *pkey, in ___neigh_lookup_noref() [all …]
|
| H A D | ndisc.h | 345 static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd) in ndisc_hashfn() argument 347 const u32 *p32 = pkey; in ndisc_hashfn() 355 static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) in __ipv6_neigh_lookup_noref() argument 357 return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev); in __ipv6_neigh_lookup_noref() 360 static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey) in __ipv6_neigh_lookup() argument 365 n = __ipv6_neigh_lookup_noref(dev, pkey); in __ipv6_neigh_lookup() 374 const void *pkey) in __ipv6_confirm_neigh() argument 379 n = __ipv6_neigh_lookup_noref(dev, pkey); in __ipv6_confirm_neigh()
|
| /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 …]
|
| H A D | trace_ibhdrs.h | 77 u16 *pkey, u32 *psn, u32 *qpn); 88 u16 *entropy, u16 *len, u16 *pkey, 95 u16 len, u16 pkey, u32 dlid, u32 slid); 100 u8 tver, u16 pkey, u32 psn, u32 qpn, 140 __field(u16, pkey) 168 &__entry->pkey, 207 &__entry->pkey, 238 __entry->pkey, 254 __entry->pkey, 299 __field(u16, pkey) [all …]
|
| H A D | ruc.c | 37 u16 pkey = packet->pkey; in hfi1_ruc_check_hdr() local 62 if (unlikely(rcv_pkey_check(ppd_from_ibp(ibp), pkey, in hfi1_ruc_check_hdr() 64 hfi1_bad_pkey(ibp, pkey, sl, 0, qp->ibqp.qp_num, in hfi1_ruc_check_hdr() 99 if (unlikely(rcv_pkey_check(ppd_from_ibp(ibp), pkey, in hfi1_ruc_check_hdr() 101 hfi1_bad_pkey(ibp, pkey, sl, 0, qp->ibqp.qp_num, in hfi1_ruc_check_hdr() 241 u16 pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); in hfi1_make_ruc_header_16B() local 286 bth0 |= pkey; in hfi1_make_ruc_header_16B() 302 pkey, becn, 0, l4, priv->s_sc); in hfi1_make_ruc_header_16B() 328 u16 pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); in hfi1_make_ruc_header_9B() local 364 bth0 |= pkey; in hfi1_make_ruc_header_9B()
|
| /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()
|
| /linux/Documentation/core-api/ |
| H A D | protection-keys.rst | 56 int pkey_free(int pkey); 58 unsigned long prot, int pkey); 60 Before a pkey can be used, it must first be allocated with pkey_alloc(). An 67 pkey = pkey_alloc(0, PKEY_DISABLE_WRITE); 69 ret = pkey_mprotect(ptr, PAGE_SIZE, real_prot, pkey); 75 pkey_set(pkey, 0); // clear PKEY_DISABLE_WRITE 77 pkey_set(pkey, PKEY_DISABLE_WRITE); // set PKEY_DISABLE_WRITE again 79 Now when it frees the memory, it will also free the pkey since it 83 pkey_free(pkey); 87 tools/testing/selftests/mm/pkey-{arm64,powerpc,x86}.h [all …]
|
| /linux/arch/x86/include/asm/ |
| H 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/tools/testing/selftests/powerpc/ptrace/ |
| H A D | Makefile | 12 TESTS_64 += core-pkey 16 TESTS_64 += ptrace-pkey 41 $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
|
| H A D | .gitignore | 14 core-pkey 15 ptrace-pkey
|
| /linux/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ |
| H A D | gh100.c | 106 gsp->fmc.fw.addr, gsp->fmc.hash, gsp->fmc.pkey, gsp->fmc.sig); in gh100_gsp_init() 269 const void *hash, *sig, *pkey, *img; in gh100_gsp_oneinit() local 282 pkey = elf_section(fw, "publickey", &pkey_len); in gh100_gsp_oneinit() 285 if (!hash || !sig || !pkey || !img) { in gh100_gsp_oneinit() 301 gsp->fmc.pkey = kmemdup(pkey, pkey_len, GFP_KERNEL); in gh100_gsp_oneinit() 303 if (!gsp->fmc.hash || !gsp->fmc.pkey || !gsp->fmc.sig) in gh100_gsp_oneinit()
|
| /linux/security/selinux/include/ |
| H A D | ibpkey.h | 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) in sel_ib_pkey_sid() argument
|
| /linux/drivers/infiniband/sw/rxe/ |
| H A D | rxe_hdr.h | 64 __be16 pkey; member 166 return be16_to_cpu(bth->pkey); in __bth_pkey() 169 static inline void __bth_set_pkey(void *arg, u16 pkey) in __bth_set_pkey() argument 173 bth->pkey = cpu_to_be16(pkey); in __bth_set_pkey() 335 static inline void bth_set_pkey(struct rxe_pkt_info *pkt, u16 pkey) in bth_set_pkey() argument 337 __bth_set_pkey(pkt->hdr, pkey); in bth_set_pkey() 406 int mig, int pad, u16 pkey, u32 qpn, int ack_req, in bth_init() argument 417 bth->pkey = cpu_to_be16(pkey); in bth_init()
|
| /linux/drivers/gpu/drm/nouveau/nvkm/subdev/fsp/ |
| H A D | base.c | 9 u64 img_addr, const u8 *hash, const u8 *pkey, const u8 *sig) in nvkm_fsp_boot_gsp_fmc() argument 12 img_addr, hash, pkey, sig); in nvkm_fsp_boot_gsp_fmc()
|