| /linux/tools/testing/selftests/drivers/dma-buf/ |
| H A D | udmabuf.c | 30 int memfd, ret; in create_memfd_with_seals() local 36 memfd = memfd_create("udmabuf-test", flags); in create_memfd_with_seals() 37 if (memfd < 0) { in create_memfd_with_seals() 42 ret = fcntl(memfd, F_ADD_SEALS, F_SEAL_SHRINK); in create_memfd_with_seals() 48 ret = ftruncate(memfd, size); in create_memfd_with_seals() 54 return memfd; in create_memfd_with_seals() 57 static int create_udmabuf_list(int devfd, int memfd, off64_t memfd_size) in create_udmabuf_list() argument 70 list->list[i].memfd = memfd; in create_udmabuf_list() 136 int devfd, memfd, buf, ret; in main() local 151 memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); in main() [all …]
|
| /linux/tools/testing/selftests/kvm/ |
| H A D | set_memory_region_test.c | 465 static void test_invalid_guest_memfd(struct kvm_vm *vm, int memfd, in test_invalid_guest_memfd() argument 470 0, memfd, offset); in test_invalid_guest_memfd() 477 int memfd, i; in test_add_private_memory_region() local 486 memfd = kvm_memfd_alloc(MEM_REGION_SIZE, false); in test_add_private_memory_region() 487 test_invalid_guest_memfd(vm, memfd, 0, "Regular memfd() should fail"); in test_add_private_memory_region() 488 close(memfd); in test_add_private_memory_region() 491 memfd = vm_create_guest_memfd(vm2, MEM_REGION_SIZE, 0); in test_add_private_memory_region() 492 test_invalid_guest_memfd(vm, memfd, 0, "Other VM's guest_memfd() should fail"); in test_add_private_memory_region() 495 MEM_REGION_GPA, MEM_REGION_SIZE, 0, memfd, 0); in test_add_private_memory_region() 496 close(memfd); in test_add_private_memory_region() [all …]
|
| /linux/tools/testing/selftests/pidfd/ |
| H A D | pidfd_getfd_test.c | 37 static int __child(int sk, int memfd) in __child() argument 53 ret = send(sk, &memfd, sizeof(memfd), 0); in __child() 54 if (ret != sizeof(memfd)) { in __child() 101 int memfd, ret; in child() local 103 memfd = sys_memfd_create("test", 0); in child() 104 if (memfd < 0) { in child() 109 ret = __child(sk, memfd); in child() 110 close(memfd); in child()
|
| /linux/drivers/dma-buf/ |
| H A D | udmabuf.c | 293 static int check_memfd_seals(struct file *memfd) in check_memfd_seals() argument 297 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in check_memfd_seals() 300 seals = memfd_fcntl(memfd, F_GET_SEALS, 0); in check_memfd_seals() 325 static long udmabuf_pin_folios(struct udmabuf *ubuf, struct file *memfd, in udmabuf_pin_folios() argument 337 nr_folios = memfd_pin_folios(memfd, start, end, folios, pgcnt, &pgoff); in udmabuf_pin_folios() 418 struct file *memfd = fget(list[i].memfd); in udmabuf_create() local 420 if (!memfd) { in udmabuf_create() 429 inode_lock_shared(file_inode(memfd)); in udmabuf_create() 430 ret = check_memfd_seals(memfd); in udmabuf_create() 434 ret = udmabuf_pin_folios(ubuf, memfd, list[i].offset, in udmabuf_create() [all …]
|
| /linux/tools/testing/selftests/exec/ |
| H A D | check-exec.c | 73 int memfd, pipefd; in FIXTURE() local 154 self->memfd = memfd_create("test-exec-probe", MFD_CLOEXEC); in FIXTURE_SETUP() 155 ASSERT_LE(0, self->memfd); in FIXTURE_SETUP() 157 ASSERT_EQ(0, fchmod(self->memfd, variant->file_exec ? 0700 : 0600)); in FIXTURE_SETUP() 294 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F() 297 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F() 304 fill_exec_fd(_metadata, self->memfd); in TEST_F() 306 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F() 309 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F()
|
| /linux/Documentation/mm/ |
| H A D | memfd_preservation.rst | 13 .. kernel-doc:: include/linux/kho/abi/memfd.h 14 :doc: DOC: memfd Live Update ABI 16 .. kernel-doc:: include/linux/kho/abi/memfd.h
|
| /linux/mm/ |
| H A D | memfd.c | 68 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument 74 if (is_file_hugepages(memfd)) { in memfd_alloc_folio() 81 struct inode *inode = file_inode(memfd); in memfd_alloc_folio() 82 struct hstate *h = hstate_file(memfd); in memfd_alloc_folio() 120 hash = hugetlb_fault_mutex_hash(memfd->f_mapping, idx); in memfd_alloc_folio() 124 memfd->f_mapping, in memfd_alloc_folio() 144 return shmem_read_folio(memfd->f_mapping, idx); in memfd_alloc_folio()
|
| H A D | gup.c | 3447 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end, in memfd_pin_folios() argument 3462 if (!memfd) in memfd_pin_folios() 3465 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in memfd_pin_folios() 3468 if (end >= i_size_read(file_inode(memfd))) in memfd_pin_folios() 3471 if (is_file_hugepages(memfd)) { in memfd_pin_folios() 3472 h = hstate_file(memfd); in memfd_pin_folios() 3481 if (is_file_hugepages(memfd)) { in memfd_pin_folios() 3494 nr_found = filemap_get_folios_contig(memfd->f_mapping, in memfd_pin_folios() 3523 folio = memfd_alloc_folio(memfd, start_idx); in memfd_pin_folios()
|
| H A D | Makefile | 140 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
|
| /linux/include/uapi/linux/ |
| H A D | udmabuf.h | 11 __u32 memfd; member 18 __u32 memfd; member
|
| /linux/include/linux/ |
| H A D | memfd.h | 11 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx); 25 static inline struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument
|
| H A D | mm.h | 2781 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
|
| /linux/tools/testing/selftests/kvm/x86/ |
| H A D | private_mem_conversions_test.c | 383 int memfd, i; in test_mem_conversions() local 397 memfd = vm_create_guest_memfd(vm, memfd_size, 0); in test_mem_conversions() 402 KVM_MEM_GUEST_MEMFD, memfd, slot_size * i); in test_mem_conversions() 431 kvm_fallocate(memfd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 0, memfd_size); in test_mem_conversions() 432 kvm_fallocate(memfd, FALLOC_FL_KEEP_SIZE, 0, memfd_size); in test_mem_conversions() 434 close(memfd); in test_mem_conversions()
|
| /linux/tools/testing/selftests/drivers/net/hw/ |
| H A D | ncdevmem.c | 62 #include <linux/memfd.h> 110 int memfd; 156 ctx->memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); in udmabuf_alloc() 157 if (ctx->memfd < 0) { in udmabuf_alloc() 158 pr_err("[skip,no-memfd]"); in udmabuf_alloc() 162 ret = fcntl(ctx->memfd, F_ADD_SEALS, F_SEAL_SHRINK); in udmabuf_alloc() 168 ret = ftruncate(ctx->memfd, size); in udmabuf_free() 170 pr_err("[FAIL,memfd-truncate]"); in udmabuf_free() 176 create.memfd = ctx->memfd; in udmabuf_memcpy_to_device() 105 int memfd; global() member [all...] |
| /linux/tools/testing/selftests/memfd/ |
| H A D | .gitignore | 5 memfd-test-file
|
| H A D | run_fuse_test.sh | 13 ./fuse_test ./mnt/memfd $@
|
| /linux/tools/testing/selftests/seccomp/ |
| H A D | seccomp_bpf.c | 4137 int status, listener, memfd, fd, nextfd; in TEST() local 4147 memfd = memfd_create("test", 0); in TEST() 4148 ASSERT_GE(memfd, 0); in TEST() 4149 nextfd = get_next_fd(memfd); in TEST() 4180 addfd.srcfd = memfd; in TEST() 4218 EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST() 4232 EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST() 4265 ASSERT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST() 4292 close(memfd); in TEST() 4299 int status, listener, memfd; in TEST() local [all …]
|
| /linux/tools/testing/selftests/ |
| H A D | Makefile | 61 TARGETS += memfd
|
| /linux/Documentation/arch/arm64/ |
| H A D | memory-tagging-extension.rst | 47 RAM-based file mappings (``tmpfs``, ``memfd``). Passing it to other
|
| /linux/Documentation/filesystems/ |
| H A D | proc.rst | 1136 as mlocked pages, ramfs backing pages, secret memfd pages etc.
|
| /linux/Documentation/virt/kvm/ |
| H A D | api.rst | 8269 ``MAP_ANONYMOUS`` or with a RAM-based file mapping (``tmpfs``, ``memfd``),
|
| /linux/ |
| H A D | MAINTAINERS | 26332 F: include/linux/memfd.h 26334 F: mm/memfd.c
|