Home
last modified time | relevance | path

Searched full:pkey (Results 1 – 25 of 174) sorted by relevance

1234567

/linux/security/selinux/
H A Dibpkey.c3 * Pkey table
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
[all …]
/linux/tools/testing/selftests/mm/
H A Dprotection_keys.c7 * * 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"
184 static u32 hw_pkey_get(int pkey, unsigned long flags) in hw_pkey_get() argument
188 dprintf1("%s(pkey=%d, flags=%lx) = %x / %d\n", in hw_pkey_get()
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
[all …]
H A Dpkey-powerpc.h28 #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 - 1) * PKEY_BITS_PER_PKEY; in pkey_bit_position()
63 dprintf4("%s() pkey register after changing %016llx to %016llx\n", in __write_pkey_reg()
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
[all …]
H A Dpkey_util.c6 #include "pkey-helpers.h"
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
28 dprintf2("%s(0x%p, %zx, prot=%lx, pkey=%lx)\n", __func__, in sys_mprotect_pkey()
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 Dpkey-helpers.h89 int sys_pkey_free(unsigned long pkey);
91 unsigned long pkey);
95 void expected_pkey_fault(int pkey);
97 unsigned long pkey);
101 #include "pkey-x86.h"
103 #include "pkey-powerpc.h"
105 #include "pkey-arm64.h"
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()
125 /* mask out bits from pkey in old value */ in set_pkey_bits()
[all …]
H A Dpkey_sighandler_tests.c6 * using an alternate signal stack, with the default pkey (pkey 0) disabled.
31 #include "pkey-helpers.h"
100 * Returns the most restrictive pkey register value that can be used by the
106 * Disallow everything except execution on pkey 0, so that each caller in pkey_reg_restrictive_default()
108 * its code mapped with pkey 0). in pkey_reg_restrictive_default()
201 * Verify that the sigsegv handler is invoked when pkey 0 is disabled.
239 * Verify that the sigsegv handler is invoked when pkey 0 is disabled.
287 int pkey; in test_sigsegv_handler_with_different_pkey_for_stack() local
314 pkey = sys_pkey_alloc(0, PKEY_UNRESTRICTED); in test_sigsegv_handler_with_different_pkey_for_stack()
315 sys_mprotect_pkey(stack, STACK_SIZE, PROT_READ | PROT_WRITE, pkey); in test_sigsegv_handler_with_different_pkey_for_stack()
[all …]
/linux/drivers/s390/crypto/
H A DMakefile16 # pkey base and api module
17 pkey-objs := pkey_base.o pkey_api.o pkey_sysfs.o
18 obj-$(CONFIG_PKEY) += pkey.o
20 # pkey cca handler module
21 pkey-cca-objs := pkey_cca.o
22 obj-$(CONFIG_PKEY_CCA) += pkey-cca.o
24 # pkey ep11 handler module
25 pkey-ep11-objs := pkey_ep11.o
26 obj-$(CONFIG_PKEY_EP11) += pkey-ep11.o
28 # pkey pckmo handler module
[all …]
/linux/arch/x86/include/asm/
H A Dpkeys.h12 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
59 * from pkey_alloc() or pkey 0 which is allocated in mm_pkey_is_allocated()
[all …]
H A Dpkru.h19 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/arch/arm64/include/asm/
H A Dpkeys.h15 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
55 * from pkey_alloc() or pkey 0 which is allocated in mm_pkey_is_allocated()
[all …]
/linux/drivers/infiniband/core/
H A Dsecurity.c48 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/arch/powerpc/mm/book3s64/
H A Dpkeys.c49 #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey+1) * AMR_BITS_PER_PKEY)) argument
76 * Pkey is not supported with Radix translation. in scan_pkey_feature()
123 * pkey_to_vmflag_bits() assumes that the pkey bits are contiguous in pkey_early_init_devtree()
136 /* scan the device tree for pkey feature */ in pkey_early_init_devtree()
262 * On hash if PKEY feature is not enabled, disable KUAP too. in setup_kuep()
288 * On hash if PKEY feature is not enabled, disable KUAP too. in setup_kuap()
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
[all …]
/linux/arch/x86/mm/
H A Dpkeys.c20 /* Do we need to assign a pkey for mm's execute-only maps? */ in __execute_only_pkey()
32 * first and assume that if the execute-only pkey is in __execute_only_pkey()
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()
98 * is using the exec-only pkey. This mapping was in __arch_override_mprotect_pkey()
100 * the default pkey. in __arch_override_mprotect_pkey()
[all …]
/linux/drivers/infiniband/ulp/ipoib/
H A Dipoib_vlan.c59 * Since the legacy sysfs interface uses pkey for deletion it cannot in is_child_unique()
60 * support more than one interface with the same pkey, it creates in is_child_unique()
69 * then all of the legacy child interfaces to make sure the Pkey in is_child_unique()
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()
[all …]
/linux/drivers/infiniband/hw/hfi1/
H A Dud.c70 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 Dtrace_ibhdrs.h77 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 …]
/linux/Documentation/core-api/
H A Dprotection-keys.rst56 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/Documentation/translations/zh_CN/core-api/
H A Dprotection-keys.rst46 int pkey_free(int pkey);
48 unsigned long prot, int pkey);
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
70 pkey_free(pkey);
85 pkey = pkey_alloc(0, PKEY_DISABLE_WRITE | PKEY_DISABLE_READ);
86 pkey_mprotect(ptr, size, PROT_READ|PROT_WRITE, pkey);
/linux/drivers/crypto/
H A DKconfig78 config PKEY config
82 With this option enabled the pkey kernel modules provide an API
87 - A pkey base and API kernel module (pkey.ko) which offers the
88 infrastructure for the pkey handler kernel modules, the ioctl
91 - A pkey pckmo kernel module (pkey-pckmo.ko) which is automatically
94 - A pkey CCA kernel module (pkey-cca.ko) which is automatically
96 - A pkey EP11 kernel module (pkey-ep11.ko) which is automatically
98 - A pkey UV kernel module (pkey-uv.ko) which is automatically
106 tristate "PKEY CCA support handler"
107 depends on PKEY
[all …]
/linux/include/net/
H A Dneighbour.h214 __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()
291 return *(const u32 *)n->primary_key == *(const u32 *)pkey;
294 static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey) in neigh_key_eq128()
297 const u32 *p32 = pkey; in neigh_key_eq128()
305 bool (*key_eq)(const struct neighbour *n, const void *pkey), in ___neigh_lookup_noref()
306 __u32 (*hash)(const void *pkey, in ___neigh_lookup_noref()
309 const void *pkey, in ___neigh_lookup_noref()
287 neigh_key_eq32(const struct neighbour * n,const void * pkey) neigh_key_eq32() argument
292 neigh_key_eq128(const struct neighbour * n,const void * pkey) neigh_key_eq128() argument
303 ___neigh_lookup_noref(struct neigh_table * tbl,bool (* key_eq)(const struct neighbour * n,const void * pkey),__u32 (* hash)(const void * pkey,const struct net_device * dev,__u32 * hash_rnd),const void * pkey,struct net_device * dev) ___neigh_lookup_noref() argument
304 ___neigh_lookup_noref(struct neigh_table * tbl,bool (* key_eq)(const struct neighbour * n,const void * pkey),__u32 (* hash)(const void * pkey,const struct net_device * dev,__u32 * hash_rnd),const void * pkey,struct net_device * dev) ___neigh_lookup_noref() argument
323 __neigh_lookup_noref(struct neigh_table * tbl,const void * pkey,struct net_device * dev) __neigh_lookup_noref() argument
347 neigh_create(struct neigh_table * tbl,const void * pkey,struct net_device * dev) neigh_create() argument
551 __neigh_lookup(struct neigh_table * tbl,const void * pkey,struct net_device * dev,int creat) __neigh_lookup() argument
563 __neigh_lookup_errno(struct neigh_table * tbl,const void * pkey,struct net_device * dev) __neigh_lookup_errno() argument
[all...]
H A Dndisc.h347 static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd) in ndisc_hashfn() argument
349 const u32 *p32 = pkey; in ndisc_hashfn()
357 static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) in __ipv6_neigh_lookup_noref() argument
359 return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev); in __ipv6_neigh_lookup_noref()
364 const void *pkey) in __ipv6_neigh_lookup_noref_stub() argument
367 ndisc_hashfn, pkey, dev); in __ipv6_neigh_lookup_noref_stub()
370 static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey) in __ipv6_neigh_lookup() argument
375 n = __ipv6_neigh_lookup_noref(dev, pkey); in __ipv6_neigh_lookup()
384 const void *pkey) in __ipv6_confirm_neigh() argument
389 n = __ipv6_neigh_lookup_noref(dev, pkey); in __ipv6_confirm_neigh()
[all …]
/linux/include/linux/
H A Dpkeys.h14 #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 Ddigsig.c74 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/crypto/asymmetric_keys/
H A Drestrict.c138 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/tools/testing/selftests/powerpc/ptrace/
H A DMakefile12 TESTS_64 += core-pkey
16 TESTS_64 += ptrace-pkey
41 $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread

1234567