Home
last modified time | relevance | path

Searched refs:mprotect (Results 1 – 25 of 64) sorted by relevance

123

/linux/tools/testing/selftests/powerpc/mm/
H A Dexec_prot.c73 if (mprotect(insns, pgsize, PROT_READ | PROT_WRITE | PROT_EXEC)) { in segv_handler()
98 FAIL_IF(mprotect(insns, pgsize, rights) != 0); in check_exec_fault()
173 FAIL_IF(mprotect(insns, pgsize, PROT_EXEC) != 0); in test()
185 FAIL_IF(mprotect(insns, pgsize, PROT_EXEC) != 0); in test()
/linux/tools/testing/selftests/futex/functional/
H A Dfutex_numa_mpol.c155 mprotect(futex_ptr + mem_size, mem_size, PROT_NONE); in TEST()
175 mprotect(futex_ptr, mem_size, PROT_READ); in TEST()
179 mprotect(futex_ptr, mem_size, PROT_NONE); in TEST()
183 mprotect(futex_ptr, mem_size, PROT_READ | PROT_WRITE); in TEST()
/linux/Documentation/translations/zh_CN/core-api/
H A Dprotection-keys.rst78 内核试图使保护密钥与普通的mprotect()的行为一致。例如,如果你这样做::
80 mprotect(ptr, size, PROT_NONE);
99 将被设置为SEGV_PKERR,而当违反普通的mprotect()权限时,则是SEGV_ACCERR。
/linux/tools/testing/selftests/mm/
H A Dmerge.c150 ASSERT_EQ(mprotect(ptr, 5 * page_size, PROT_READ), 0); in TEST_F()
170 ASSERT_EQ(mprotect(&ptr[5 * page_size], 5 * page_size, PROT_READ), 0); in TEST_F()
201 ASSERT_EQ(mprotect(&ptr[5 * page_size], 5 * page_size, PROT_READ), 0); in TEST_F()
220 ASSERT_EQ(mprotect(ptr, 5 * page_size, PROT_READ), 0); in TEST_F()
251 ASSERT_EQ(mprotect(ptr, 3 * page_size, PROT_READ), 0); in TEST_F()
252 ASSERT_EQ(mprotect(&ptr[6 * page_size], 3 * page_size, PROT_READ), 0); in TEST_F()
271 ASSERT_EQ(mprotect(&ptr[3 * page_size], 3 * page_size, PROT_READ), 0); in TEST_F()
302 ASSERT_EQ(mprotect(&ptr[6 * page_size], 3 * page_size, PROT_READ), 0); in TEST_F()
321 ASSERT_EQ(mprotect(ptr, 3 * page_size, PROT_READ), 0); in TEST_F()
330 ASSERT_EQ(mprotect(&ptr[3 * page_size], 3 * page_size, PROT_READ), 0); in TEST_F()
[all …]
H A Dmkdirty.c173 if (mprotect(mem, pagesize, PROT_READ)) { in test_page_migration()
206 if (mprotect(mem, thpsize, PROT_READ)) { in test_page_migration_thp()
245 if (mprotect(mem, thpsize, PROT_READ)) { in test_pte_mapped_thp()
257 if (mprotect(mem + thpsize - pagesize, pagesize, in test_pte_mapped_thp()
H A Dmdwe_test.c240 ret = mprotect(self->p, self->size, PROT_READ | PROT_EXEC); in TEST_F()
251 ret = mprotect(self->p, self->size, PROT_READ | PROT_EXEC); in TEST_F()
266 ret = mprotect(self->p, self->size, PROT_WRITE | PROT_EXEC); in TEST_F()
299 ret = mprotect(self->p, self->size, PROT_EXEC | PROT_BTI); in TEST_F()
H A Dsoft-dirty.c171 mprotect(map, pagesize, PROT_READ); in test_mprotect()
175 mprotect(map, pagesize, PROT_READ|PROT_WRITE); in test_mprotect()
301 if (mprotect(map, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC)) in test_merge()
H A Dcow.c216 ret = mprotect(mem, size, PROT_READ); in do_test_cow_in_parent()
225 ret = mprotect(mem, size, PROT_READ|PROT_WRITE); in do_test_cow_in_parent()
496 ret = mprotect(mem, size, PROT_READ); in do_test_iouring()
504 ret = mprotect(mem, size, PROT_READ | PROT_WRITE); in do_test_iouring()
675 ret = mprotect(mem, size, PROT_READ); in do_test_ro_pin()
677 ret |= mprotect(mem, size, PROT_READ | PROT_WRITE); in do_test_ro_pin()
892 ret = mprotect(mem + pagesize, pagesize, PROT_READ); in do_run_with_thp()
898 ret = mprotect(mem + pagesize, pagesize, PROT_READ | PROT_WRITE); in do_run_with_thp()
1293 ret = mprotect(mem + pagesize, pagesize, PROT_READ); in do_test_anon_thp_collapse()
1299 ret = mprotect(mem + pagesize, pagesize, PROT_READ | PROT_WRITE); in do_test_anon_thp_collapse()
H A Dpagemap_ioctl.c202 mprotect(mem, mem_size/8, PROT_READ|PROT_WRITE); in userfaultfd_tests()
203 mprotect(mem + 1 * mem_size/8, mem_size/8, PROT_READ); in userfaultfd_tests()
204 mprotect(mem + 2 * mem_size/8, mem_size/8, PROT_READ|PROT_WRITE); in userfaultfd_tests()
205 mprotect(mem + 3 * mem_size/8, mem_size/8, PROT_READ); in userfaultfd_tests()
206 mprotect(mem + 4 * mem_size/8, mem_size/8, PROT_READ|PROT_WRITE); in userfaultfd_tests()
207 mprotect(mem + 5 * mem_size/8, mem_size/8, PROT_NONE); in userfaultfd_tests()
208 mprotect(mem + 6 * mem_size/8, mem_size/8, PROT_READ|PROT_WRITE); in userfaultfd_tests()
209 mprotect(mem + 7 * mem_size/8, mem_size/8, PROT_READ); in userfaultfd_tests()
1369 mprotect(mem, page_size, PROT_NONE); in mprotect_tests()
1370 mprotect(mem, 2 * page_size, PROT_READ); in mprotect_tests()
[all …]
H A Dhmm-tests.c382 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
407 * mprotect() PROT_NONE. in TEST_F()
436 ret = mprotect(buffer->ptr, size, PROT_NONE); in TEST_F()
444 ret = mprotect(buffer->ptr, size, PROT_READ); in TEST_F()
496 * mprotect() PROT_READ. in TEST_F()
535 ret = mprotect(buffer->ptr, size, PROT_WRITE | PROT_READ);
1137 ret = mprotect(buffer->ptr + 2 * self->page_size, self->page_size, in TEST_F()
1145 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, in TEST_F()
1150 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, in TEST_F()
1155 ret = mprotect(buffe
[all...]
H A Dguard-regions.c703 TEST_F(guard_regions, mprotect) in TEST_F() argument
722 ASSERT_EQ(mprotect(&ptr[5 * page_size], 2 * page_size, PROT_READ), 0); in TEST_F()
829 ASSERT_EQ(mprotect(ptr, 3 * page_size, PROT_READ), 0); in TEST_F()
830 ASSERT_EQ(mprotect(&ptr[7 * page_size], 3 * page_size, PROT_READ), 0); in TEST_F()
840 ASSERT_EQ(mprotect(ptr, 3 * page_size, PROT_READ | PROT_WRITE), 0); in TEST_F()
841 ASSERT_EQ(mprotect(&ptr[7 * page_size], 3 * page_size, in TEST_F()
852 ASSERT_EQ(mprotect(ptr, 3 * page_size, PROT_READ), 0); in TEST_F()
853 ASSERT_EQ(mprotect(&ptr[7 * page_size], 3 * page_size, PROT_READ), 0); in TEST_F()
866 ASSERT_EQ(mprotect(ptr, 3 * page_size, PROT_READ | PROT_WRITE), 0); in TEST_F()
867 ASSERT_EQ(mprotect(&ptr[7 * page_size], 3 * page_size, in TEST_F()
/linux/tools/testing/selftests/powerpc/primitives/
H A Dload_unaligned_zeropad.c43 if (mprotect(mem_region + page_size, page_size, PROT_NONE)) { in protect_region()
53 if (mprotect(mem_region + page_size, page_size, PROT_READ|PROT_WRITE)) { in unprotect_region()
/linux/tools/testing/selftests/bpf/prog_tests/
H A Dringbuf.c171 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_cons_pos_protect"); in ringbuf_subtest()
195 ASSERT_ERR(mprotect(mmap_ptr, 4 * page_size, PROT_WRITE), "write_protect"); in ringbuf_subtest()
196 ASSERT_ERR(mprotect(mmap_ptr, 4 * page_size, PROT_EXEC), "exec_protect"); in ringbuf_subtest()
205 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_WRITE), "write_protect"); in ringbuf_subtest()
206 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_protect"); in ringbuf_subtest()
H A Dmmap.c135 err = mprotect(map_mmaped, map_sz, PROT_READ); in test_mmap()
152 err = mprotect(map_mmaped, map_sz, PROT_WRITE); in test_mmap()
155 err = mprotect(map_mmaped, map_sz, PROT_EXEC); in test_mmap()
H A Duser_ringbuf.c113 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_WRITE), "write_cons_pos_protect"); in test_user_ringbuf_mappings()
114 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_cons_pos_protect"); in test_user_ringbuf_mappings()
124 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_prod_pos_protect"); in test_user_ringbuf_mappings()
133 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_data_protect"); in test_user_ringbuf_mappings()
/linux/Documentation/core-api/
H A Dprotection-keys.rst93 behavior of a plain mprotect(). For instance if you do this::
95 mprotect(ptr, size, PROT_NONE);
116 the plain mprotect() permissions are violated.
120 userspace's value of the register or mprotect().
/linux/Documentation/arch/sparc/
H A Dadi.rst39 ADI is enabled on a set of pages using mprotect() with PROT_ADI flag.
83 range, enable ADI on the range using mprotect() and set version tags
84 for the entire range. mprotect() ensures range is aligned to page size
226 if (mprotect(shmaddr, BUFFER_SIZE, PROT_READ|PROT_WRITE|PROT_ADI)) {
227 perror("mprotect failed");
270 if (mprotect(shmaddr, BUFFER_SIZE, PROT_READ|PROT_WRITE)) {
271 perror("mprotect failed");
/linux/Documentation/ABI/removed/
H A Dsysfs-selinux-checkreqprot11 to check the protection requested by userspace for mmap/mprotect
23 check the actual protections being applied upon mmap/mprotect calls.
/linux/tools/testing/selftests/kvm/s390/
H A Dtprot.c219 mprotect(addr_gva2hva(vm, (gva_t)pages), PAGE_SIZE * 2, PROT_READ); in main()
232 mprotect(addr_gva2hva(vm, (gva_t)0), PAGE_SIZE, PROT_READ); in main()
/linux/tools/testing/selftests/arm64/signal/testcases/
H A Dgcs_prot_none_fault.c43 if (mprotect(gcs_page, sysconf(_SC_PAGE_SIZE), PROT_NONE) != 0) { in gcs_prot_none_fault_trigger()
/linux/tools/testing/selftests/powerpc/signal/
H A Dsigreturn_vdso.c114 mprotect((void *)low, size, PROT_READ|PROT_WRITE|PROT_EXEC); in test_sigreturn_vdso()
/linux/tools/testing/selftests/powerpc/copyloops/
H A Dexc_validate.c98 if (mprotect(p + page_size, page_size, PROT_NONE)) { in test_copy_exception()
/linux/tools/testing/selftests/kvm/
H A Dmmu_stress_test.c39 * Write to the region while mprotect(PROT_READ) is underway. Keep in guest_code()
148 * the mprotect(PROT_READ) lands. Only architectures that support in vcpu_worker()
190 * Stage 4. Run to completion, waiting for mprotect(PROT_WRITE) to in vcpu_worker()
379 mprotect(mem, slot_size, PROT_READ); in main()
382 rendezvous_with_vcpus(&time_ro, "mprotect RO"); in main()
383 mprotect(mem, slot_size, PROT_READ | PROT_WRITE); in main()
384 rendezvous_with_vcpus(&time_rw, "mprotect RW"); in main()
/linux/arch/um/os-Linux/
H A Dutil.c23 if (mprotect((void *) address, UM_THREAD_SIZE, PROT_READ | PROT_WRITE) < 0) in stack_protections()
/linux/tools/testing/selftests/x86/
H A Dtest_shadow_stack.c412 if (mprotect(shstk_ptr, SS_SIZE, PROT_READ) < 0) { in test_mprotect()
427 if (mprotect(shstk_ptr, SS_SIZE, PROT_READ) < 0) { in test_mprotect()
433 if (mprotect(shstk_ptr, SS_SIZE, PROT_WRITE | PROT_READ) < 0) { in test_mprotect()

123