Home
last modified time | relevance | path

Searched refs:memfd (Results 1 – 23 of 23) sorted by relevance

/linux-6.15/tools/testing/selftests/drivers/dma-buf/
H A Dudmabuf.c30 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 Dmfd_noexec.rst13 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 Dset_memory_region_test.c471 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 Dpidfd_getfd_test.c37 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 Dudmabuf.c302 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 DKconfig41 A driver to let userspace turn memfd regions into dma-bufs.
/linux-6.15/tools/testing/selftests/exec/
H A Dcheck-exec.c73 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 Dudmabuf.h11 __u32 memfd; member
18 __u32 memfd; member
/linux-6.15/include/linux/
H A Dmemfd.h9 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 Dmm.h2638 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
/linux-6.15/mm/
H A Dmemfd.c68 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 Dgup.c3644 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 DMakefile140 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
/linux-6.15/tools/testing/selftests/drivers/net/hw/
H A Dncdevmem.c88 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 Dprivate_mem_conversions_test.c383 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.gitignore5 memfd-test-file
H A Drun_fuse_test.sh13 ./fuse_test ./mnt/memfd $@
/linux-6.15/tools/testing/selftests/seccomp/
H A Dseccomp_bpf.c4127 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 DMakefile58 TARGETS += memfd
/linux-6.15/Documentation/arch/arm64/
H A Dmemory-tagging-extension.rst47 RAM-based file mappings (``tmpfs``, ``memfd``). Passing it to other
/linux-6.15/Documentation/filesystems/
H A Dproc.rst1140 as mlocked pages, ramfs backing pages, secret memfd pages etc.
/linux-6.15/Documentation/virt/kvm/
H A Dapi.rst8071 ``MAP_ANONYMOUS`` or with a RAM-based file mapping (``tmpfs``, ``memfd``),
/linux-6.15/
H A DMAINTAINERS15512 F: include/linux/memfd.h