/linux-6.12.1/tools/testing/selftests/drivers/dma-buf/ |
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-6.12.1/tools/testing/selftests/kvm/ |
D | set_memory_region_test.c | 466 static void test_invalid_guest_memfd(struct kvm_vm *vm, int memfd, in test_invalid_guest_memfd() argument 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() 488 test_invalid_guest_memfd(vm, memfd, 0, "Regular memfd() should fail"); in test_add_private_memory_region() 489 close(memfd); in test_add_private_memory_region() 492 memfd = vm_create_guest_memfd(vm2, MEM_REGION_SIZE, 0); in test_add_private_memory_region() 493 test_invalid_guest_memfd(vm, memfd, 0, "Other VM's guest_memfd() should fail"); in test_add_private_memory_region() 496 MEM_REGION_GPA, MEM_REGION_SIZE, 0, memfd, 0); in test_add_private_memory_region() 497 close(memfd); in test_add_private_memory_region() [all …]
|
/linux-6.12.1/Documentation/userspace-api/ |
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.12.1/tools/testing/selftests/pidfd/ |
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.12.1/drivers/dma-buf/ |
D | udmabuf.c | 253 static int check_memfd_seals(struct file *memfd) in check_memfd_seals() argument 257 if (!memfd) in check_memfd_seals() 260 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in check_memfd_seals() 263 seals = memfd_fcntl(memfd, F_GET_SEALS, 0); in check_memfd_seals() 300 struct file *memfd = NULL; in udmabuf_create() local 340 memfd = fget(list[i].memfd); in udmabuf_create() 341 ret = check_memfd_seals(memfd); in udmabuf_create() 353 ret = memfd_pin_folios(memfd, list[i].offset, end, in udmabuf_create() 386 fput(memfd); in udmabuf_create() 387 memfd = NULL; in udmabuf_create() [all …]
|
D | Kconfig | 40 A driver to let userspace turn memfd regions into dma-bufs.
|
/linux-6.12.1/tools/testing/selftests/net/ |
D | ncdevmem.c | 205 static void create_udmabuf(int *devfd, int *memfd, int *buf, size_t dmabuf_size) in create_udmabuf() argument 217 *memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); in create_udmabuf() 218 if (*memfd < 0) in create_udmabuf() 222 ret = fcntl(*memfd, F_ADD_SEALS, F_SEAL_SHRINK); in create_udmabuf() 226 ret = ftruncate(*memfd, dmabuf_size); in create_udmabuf() 232 create.memfd = *memfd; in create_udmabuf() 248 int devfd, memfd, buf, ret; in do_server() local 264 create_udmabuf(&devfd, &memfd, &buf, dmabuf_size); in do_server() 458 close(memfd); in do_server() 468 int devfd, memfd, buf; in run_devmem_tests() local [all …]
|
/linux-6.12.1/include/linux/ |
D | memfd.h | 9 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx); 15 static inline struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument
|
D | mm.h | 2524 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
|
/linux-6.12.1/include/uapi/linux/ |
D | udmabuf.h | 11 __u32 memfd; member 18 __u32 memfd; member
|
/linux-6.12.1/mm/ |
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()
|
D | gup.c | 3652 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end, in memfd_pin_folios() argument 3667 if (!memfd) in memfd_pin_folios() 3670 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in memfd_pin_folios() 3673 if (end >= i_size_read(file_inode(memfd))) in memfd_pin_folios() 3676 if (is_file_hugepages(memfd)) { in memfd_pin_folios() 3677 h = hstate_file(memfd); in memfd_pin_folios() 3686 if (is_file_hugepages(memfd)) { in memfd_pin_folios() 3699 nr_found = filemap_get_folios_contig(memfd->f_mapping, in memfd_pin_folios() 3741 folio = memfd_alloc_folio(memfd, start_idx); in memfd_pin_folios()
|
D | Makefile | 138 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
|
/linux-6.12.1/tools/testing/selftests/kvm/x86_64/ |
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.12.1/tools/testing/selftests/memfd/ |
D | .gitignore | 5 memfd-test-file
|
D | run_fuse_test.sh | 13 ./fuse_test ./mnt/memfd $@
|
/linux-6.12.1/tools/testing/selftests/seccomp/ |
D | seccomp_bpf.c | 4116 int status, listener, memfd, fd, nextfd; in TEST() local 4126 memfd = memfd_create("test", 0); in TEST() 4127 ASSERT_GE(memfd, 0); in TEST() 4128 nextfd = get_next_fd(memfd); in TEST() 4159 addfd.srcfd = memfd; in TEST() 4197 EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST() 4211 EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST() 4244 ASSERT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST() 4271 close(memfd); in TEST() 4278 int status, listener, memfd; in TEST() local [all …]
|
/linux-6.12.1/tools/testing/selftests/ |
D | Makefile | 56 TARGETS += memfd
|
/linux-6.12.1/Documentation/arch/arm64/ |
D | memory-tagging-extension.rst | 47 RAM-based file mappings (``tmpfs``, ``memfd``). Passing it to other
|
/linux-6.12.1/Documentation/filesystems/ |
D | proc.rst | 1105 as mlocked pages, ramfs backing pages, secret memfd pages etc.
|
/linux-6.12.1/Documentation/virt/kvm/ |
D | api.rst | 7991 ``MAP_ANONYMOUS`` or with a RAM-based file mapping (``tmpfs``, ``memfd``),
|
/linux-6.12.1/ |
D | MAINTAINERS | 14855 F: include/linux/memfd.h
|