/linux-master/tools/testing/selftests/x86/ |
H A D | test_shadow_stack.c | 409 /* mprotect a shadow stack as read only */ 411 if (mprotect(shstk_ptr, SS_SIZE, PROT_READ) < 0) { 426 if (mprotect(shstk_ptr, SS_SIZE, PROT_READ) < 0) { 432 if (mprotect(shstk_ptr, SS_SIZE, PROT_WRITE | PROT_READ) < 0) { 439 printf("[FAIL]\tShadow stack access to mprotect() writable memory failed\n"); 896 printf("[FAIL]\tShadow shadow mprotect test\n");
|
/linux-master/tools/testing/selftests/mm/ |
H A D | soft-dirty.c | 161 mprotect(map, pagesize, PROT_READ); 165 mprotect(map, pagesize, PROT_READ|PROT_WRITE);
|
H A D | ksm_functional_tests.c | 192 if (mprotect(map, size, prot)) { 193 ksft_print_msg("mprotect() failed\n");
|
H A D | gup_longterm.c | 131 ret = mprotect(mem, size, PROT_READ); 133 ksft_test_result_fail("mprotect() failed\n");
|
H A D | cow.c | 227 * mprotect() optimizations might try avoiding 230 ret = mprotect(mem, size, PROT_READ); 231 ret |= mprotect(mem, size, PROT_READ|PROT_WRITE); 233 ksft_test_result_fail("mprotect() failed\n"); 481 * again by mprotect() optimizations. Note that we don't have an 485 ret = mprotect(mem, size, PROT_READ); 487 ret |= mprotect(mem, size, PROT_READ | PROT_WRITE); 489 ksft_test_result_fail("mprotect() failed\n"); 641 * again by mprotect() optimizations. Note that we don't have an 645 ret = mprotect(me [all...] |
H A D | pagemap_ioctl.c | 198 mprotect(mem, mem_size/8, PROT_READ|PROT_WRITE); 199 mprotect(mem + 1 * mem_size/8, mem_size/8, PROT_READ); 200 mprotect(mem + 2 * mem_size/8, mem_size/8, PROT_READ|PROT_WRITE); 201 mprotect(mem + 3 * mem_size/8, mem_size/8, PROT_READ); 202 mprotect(mem + 4 * mem_size/8, mem_size/8, PROT_READ|PROT_WRITE); 203 mprotect(mem + 5 * mem_size/8, mem_size/8, PROT_NONE); 204 mprotect(mem + 6 * mem_size/8, mem_size/8, PROT_READ|PROT_WRITE); 205 mprotect(mem + 7 * mem_size/8, mem_size/8, PROT_READ); 1265 mprotect(mem, page_size, PROT_NONE); 1266 mprotect(me [all...] |
H A D | mkdirty.c | 173 if (mprotect(mem, pagesize, PROT_READ)) { 174 ksft_test_result_fail("mprotect() failed\n"); 206 if (mprotect(mem, thpsize, PROT_READ)) { 207 ksft_test_result_fail("mprotect() failed\n"); 245 if (mprotect(mem, thpsize, PROT_READ)) { 246 ksft_test_result_fail("mprotect() failed\n"); 256 /* Trigger PTE-mapping the THP by mprotect'ing the last subpage. */ 257 if (mprotect(mem + thpsize - pagesize, pagesize, 259 ksft_test_result_fail("mprotect() failed\n");
|
H A D | protection_keys.c | 18 * do a plain mprotect() to a mprotect_pkey() area and make sure the pkey sticks 543 * I had a bug where pkey bits could be set by mprotect() but 974 * This is a bit of a hack. But mprotect() requires 1357 * This is a bit of a hack. But mprotect() requires 1511 /* Use a *normal* mprotect(), not mprotect_pkey(): */ 1512 ret = mprotect(p1, PAGE_SIZE, PROT_EXEC); 1516 * Reset the shadow, assuming that the above mprotect() 1536 ret = mprotect(p1, PAGE_SIZE, PROT_NONE); 1539 ret = mprotect(p1, PAGE_SIZE, PROT_READ|PROT_EXEC);
|
H A D | mdwe_test.c | 241 ret = mprotect(self->p, self->size, PROT_READ | PROT_EXEC); 252 ret = mprotect(self->p, self->size, PROT_READ | PROT_EXEC); 267 ret = mprotect(self->p, self->size, PROT_WRITE | PROT_EXEC); 300 ret = mprotect(self->p, self->size, PROT_EXEC | PROT_BTI);
|
H A D | hmm-tests.c | 329 ret = mprotect(buffer->ptr, size, PROT_READ); 354 * mprotect() PROT_NONE. 392 ret = mprotect(buffer->ptr, size, PROT_NONE); 400 ret = mprotect(buffer->ptr, size, PROT_READ); 461 * mprotect() PROT_READ. 509 ret = mprotect(buffer->ptr, size, PROT_WRITE | PROT_READ); 1191 ret = mprotect(buffer->ptr + 2 * self->page_size, self->page_size, 1199 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, 1204 ret = mprotect(buffer->ptr + 3 * self->page_size, self->page_size, 1209 ret = mprotect(buffe [all...] |
H A D | ksm_tests.c | 209 if (mprotect(map_ptr, map_size, prot)) { 210 perror("mprotect");
|
/linux-master/tools/testing/selftests/memfd/ |
H A D | memfd_test.c | 470 * mprotect(PROT_WRITE) allows writing */ 482 r = mprotect(p, mfd_def_size, PROT_READ | PROT_WRITE); 484 printf("mprotect() failed: %m\n"); 539 /* Verify PROT_READ with MAP_SHARED with a following mprotect is not 548 r = mprotect(p, mfd_def_size, PROT_READ | PROT_WRITE); 550 printf("mmap()+mprotect() didn't fail as expected\n");
|
/linux-master/mm/ |
H A D | mprotect.c | 3 * mm/mprotect.c 527 * Ordinary protection updates (mprotect, uffd-wp, softdirty tracking) 679 * pkey==-1 when doing a legacy mprotect() 769 * Each mprotect() call explicitly passes r/w/x permissions. 770 * If a permission is not passed to mprotect(), it must be 804 if (vma->vm_ops && vma->vm_ops->mprotect) { 805 error = vma->vm_ops->mprotect(vma, nstart, tmp, newflags); 828 SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
|
H A D | Makefile | 37 mlock.o mmap.o mmu_gather.o mprotect.o mremap.o \
|
/linux-master/include/linux/ |
H A D | mm.h | 272 /* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */ 273 #define VM_MAYREAD 0x00000010 /* limits for mprotect() etc */ 583 * Called by mprotect() to make driver-specific permission 584 * checks before mprotect() is finalised. The VMA must not 585 * be modified. Returns 0 if mprotect() can proceed. 587 int (*mprotect)(struct vm_area_struct *vma, unsigned long start, member in struct:vm_operations_struct 1635 * ptrace does not apply. Note that there is no mprotect() to upgrade 4213 * MAP_SHARED and read-only, take care to not allow mprotect to
|
/linux-master/tools/testing/selftests/kvm/s390x/ |
H A D | tprot.c | 87 * Since the page tables are shared, the host uses mprotect to achieve 100 * host: write protect both via mprotect 220 mprotect(addr_gva2hva(vm, (vm_vaddr_t)pages), PAGE_SIZE * 2, PROT_READ); 233 mprotect(addr_gva2hva(vm, (vm_vaddr_t)0), PAGE_SIZE, PROT_READ);
|
/linux-master/tools/testing/selftests/bpf/prog_tests/ |
H A D | ringbuf.c | 116 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_cons_pos_protect"); 140 ASSERT_ERR(mprotect(mmap_ptr, 4 * page_size, PROT_WRITE), "write_protect"); 141 ASSERT_ERR(mprotect(mmap_ptr, 4 * page_size, PROT_EXEC), "exec_protect"); 150 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_WRITE), "write_protect"); 151 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_protect");
|
H A D | user_ringbuf.c | 110 /* cons_pos can be mapped R/O, can't add +X with mprotect. */ 113 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_WRITE), "write_cons_pos_protect"); 114 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_cons_pos_protect"); 120 /* prod_pos can be mapped RW, can't add +X with mprotect. */ 124 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_prod_pos_protect"); 129 /* data pages can be mapped RW, can't add +X with mprotect. */ 133 ASSERT_ERR(mprotect(mmap_ptr, page_size, PROT_EXEC), "exec_data_protect");
|
H A D | test_lsm.c | 32 ret = mprotect(GET_PAGE_ADDR(buf, sz), sz,
|
H A D | mmap.c | 135 err = mprotect(map_mmaped, map_sz, PROT_READ); 136 if (CHECK(err, "mprotect_ro", "mprotect to r/o failed %d\n", errno)) 152 err = mprotect(map_mmaped, map_sz, PROT_WRITE); 153 if (CHECK(!err, "mprotect_wr", "mprotect() succeeded unexpectedly!\n")) 155 err = mprotect(map_mmaped, map_sz, PROT_EXEC); 156 if (CHECK(!err, "mprotect_ex", "mprotect() succeeded unexpectedly!\n"))
|
/linux-master/arch/um/os-Linux/ |
H A D | util.c | 23 if (mprotect((void *) address, UM_THREAD_SIZE,
|
/linux-master/kernel/ |
H A D | sys_ni.c | 181 COND_SYSCALL(mprotect); variable
|
/linux-master/arch/x86/kernel/cpu/sgx/ |
H A D | encl.c | 688 .mprotect = sgx_vma_mprotect,
|
/linux-master/arch/um/kernel/ |
H A D | tlb.c | 36 } mprotect; member in union:host_vm_change::host_vm_op::__anon20 97 op->u.mprotect.addr, 98 op->u.mprotect.len, 99 op->u.mprotect.prot, 103 (void *) op->u.mprotect.addr, 104 op->u.mprotect.len, 195 (last->u.mprotect.addr + last->u.mprotect.len == addr) && 196 (last->u.mprotect.prot == prot)) { 197 last->u.mprotect [all...] |
/linux-master/tools/testing/selftests/arm64/mte/ |
H A D | check_mmap_options.c | 147 if (mprotect(map_ptr, map_size, prot_flag)) { 150 ksft_print_msg("FAIL: mprotect not ignoring clear PROT_MTE property\n"); 170 if (mprotect(map_ptr, map_size, prot_flag)) { 171 ksft_print_msg("FAIL: mprotect not ignoring clear PROT_MTE property\n"); 215 "Check file memory with private mapping, sync error mode, mmap/mprotect memory and tag check off\n"); 221 "Check file memory with private mapping, no error mode, mmap/mprotect memory and tag check off\n"); 226 "Check anonymous memory with private mapping, sync error mode, mmap/mprotect memory and tag check on\n"); 230 "Check anonymous memory with shared mapping, sync error mode, mmap/mprotect memory and tag check on\n"); 234 "Check anonymous memory with private mapping, async error mode, mmap/mprotect memory and tag check on\n"); 238 "Check anonymous memory with shared mapping, async error mode, mmap/mprotect memor [all...] |