| /linux-6.15/tools/testing/selftests/drivers/dma-buf/ |
| H A D | udmabuf.c | 30 int memfd, ret; in create_memfd_with_seals() local 37 if (memfd < 0) { in create_memfd_with_seals() 54 return memfd; in create_memfd_with_seals() 70 list->list[i].memfd = memfd; in create_udmabuf_list() 152 if (memfd < 0) { in main() 173 create.memfd = memfd; in main() 183 create.memfd = memfd; in main() 206 create.memfd = memfd; in main() 217 close(memfd); in main() 234 close(memfd); in main() [all …]
|
| /linux-6.15/Documentation/userspace-api/ |
| H A D | mfd_noexec.rst | 13 Since Linux introduced the memfd feature, memfds have always had their 19 boot), this executable nature of memfd opens a door for NoExec bypass 21 process created a memfd to share the content with an external process, 22 however the memfd is overwritten and used for executing arbitrary code 25 On the other hand, executable memfd has its legit use: runc uses memfd’s 32 - Let memfd be sealed for modifying X bit when NX is set. 41 When MFD_NOEXEC_SEAL bit is set in the ``flags``, memfd is created 42 with NX. F_SEAL_EXEC is set and the memfd can't be modified to 44 This is the most common case for the application to use memfd. 47 When MFD_EXEC bit is set in the ``flags``, memfd is created with X. [all …]
|
| /linux-6.15/tools/testing/selftests/kvm/ |
| H A D | set_memory_region_test.c | 471 0, memfd, offset); in test_invalid_guest_memfd() 478 int memfd, i; in test_add_private_memory_region() local 487 memfd = kvm_memfd_alloc(MEM_REGION_SIZE, false); in test_add_private_memory_region() 489 close(memfd); in test_add_private_memory_region() 497 close(memfd); in test_add_private_memory_region() 506 close(memfd); in test_add_private_memory_region() 514 int memfd; in test_add_overlapping_private_memory_regions() local 528 0, memfd, MEM_REGION_SIZE * 2); in test_add_overlapping_private_memory_regions() 541 0, memfd, 0); in test_add_overlapping_private_memory_regions() 549 0, memfd, 0); in test_add_overlapping_private_memory_regions() [all …]
|
| /linux-6.15/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-6.15/drivers/dma-buf/ |
| H A D | udmabuf.c | 302 static int check_memfd_seals(struct file *memfd) in check_memfd_seals() argument 306 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in check_memfd_seals() 309 seals = memfd_fcntl(memfd, F_GET_SEALS, 0); in check_memfd_seals() 427 struct file *memfd = fget(list[i].memfd); in udmabuf_create() local 429 if (!memfd) { in udmabuf_create() 438 inode_lock_shared(file_inode(memfd)); in udmabuf_create() 439 ret = check_memfd_seals(memfd); in udmabuf_create() 443 ret = udmabuf_pin_folios(ubuf, memfd, list[i].offset, in udmabuf_create() 446 inode_unlock_shared(file_inode(memfd)); in udmabuf_create() 447 fput(memfd); in udmabuf_create() [all …]
|
| H A D | Kconfig | 41 A driver to let userspace turn memfd regions into dma-bufs.
|
| /linux-6.15/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-6.15/include/uapi/linux/ |
| H A D | udmabuf.h | 11 __u32 memfd; member 18 __u32 memfd; member
|
| /linux-6.15/include/linux/ |
| H A D | memfd.h | 9 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx); 23 static inline struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument
|
| H A D | mm.h | 2638 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
|
| /linux-6.15/mm/ |
| H A D | memfd.c | 68 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument 75 if (is_file_hugepages(memfd)) { in memfd_alloc_folio() 82 struct hstate *h = hstate_file(memfd); in memfd_alloc_folio() 94 memfd->f_mapping, in memfd_alloc_folio() 106 return shmem_read_folio(memfd->f_mapping, idx); in memfd_alloc_folio()
|
| H A D | gup.c | 3644 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end, in memfd_pin_folios() argument 3659 if (!memfd) in memfd_pin_folios() 3662 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in memfd_pin_folios() 3665 if (end >= i_size_read(file_inode(memfd))) in memfd_pin_folios() 3668 if (is_file_hugepages(memfd)) { in memfd_pin_folios() 3669 h = hstate_file(memfd); in memfd_pin_folios() 3678 if (is_file_hugepages(memfd)) { in memfd_pin_folios() 3691 nr_found = filemap_get_folios_contig(memfd->f_mapping, in memfd_pin_folios() 3733 folio = memfd_alloc_folio(memfd, start_idx); in memfd_pin_folios()
|
| H A D | Makefile | 140 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
|
| /linux-6.15/tools/testing/selftests/drivers/net/hw/ |
| H A D | ncdevmem.c | 88 int memfd; member 117 ctx->memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); in udmabuf_alloc() 118 if (ctx->memfd < 0) in udmabuf_alloc() 121 ret = fcntl(ctx->memfd, F_ADD_SEALS, F_SEAL_SHRINK); in udmabuf_alloc() 125 ret = ftruncate(ctx->memfd, size); in udmabuf_alloc() 131 create.memfd = ctx->memfd; in udmabuf_alloc() 150 close(ctx->memfd); in udmabuf_free()
|
| /linux-6.15/tools/testing/selftests/kvm/x86/ |
| H A D | private_mem_conversions_test.c | 383 int memfd, i, r; 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 r = fallocate(memfd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 0, memfd_size); in test_mem_conversions() 434 r = fallocate(memfd, FALLOC_FL_KEEP_SIZE, 0, memfd_size); in test_mem_conversions() 437 close(memfd); in test_mem_conversions()
|
| /linux-6.15/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-6.15/tools/testing/selftests/seccomp/ |
| H A D | seccomp_bpf.c | 4127 int status, listener, memfd, fd, nextfd; in TEST() local 4137 memfd = memfd_create("test", 0); in TEST() 4138 ASSERT_GE(memfd, 0); in TEST() 4139 nextfd = get_next_fd(memfd); in TEST() 4170 addfd.srcfd = memfd; in TEST() 4282 close(memfd); in TEST() 4289 int status, listener, memfd; in TEST() local 4298 memfd = memfd_create("test", 0); in TEST() 4299 ASSERT_GE(memfd, 0); in TEST() 4322 addfd.srcfd = memfd; in TEST() [all …]
|
| /linux-6.15/tools/testing/selftests/ |
| H A D | Makefile | 58 TARGETS += memfd
|
| /linux-6.15/Documentation/arch/arm64/ |
| H A D | memory-tagging-extension.rst | 47 RAM-based file mappings (``tmpfs``, ``memfd``). Passing it to other
|
| /linux-6.15/Documentation/filesystems/ |
| H A D | proc.rst | 1140 as mlocked pages, ramfs backing pages, secret memfd pages etc.
|
| /linux-6.15/Documentation/virt/kvm/ |
| H A D | api.rst | 8071 ``MAP_ANONYMOUS`` or with a RAM-based file mapping (``tmpfs``, ``memfd``),
|
| /linux-6.15/ |
| H A D | MAINTAINERS | 15512 F: include/linux/memfd.h
|