Home
last modified time | relevance | path

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

/linux/tools/testing/selftests/drivers/dma-buf/
H A Dudmabuf.c30 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 Dset_memory_region_test.c458 static void test_invalid_guest_memfd(struct kvm_vm *vm, int memfd, in test_invalid_guest_memfd() argument
463 0, memfd, offset); in test_invalid_guest_memfd()
470 int memfd, i; in test_add_private_memory_region() local
479 memfd = kvm_memfd_alloc(MEM_REGION_SIZE, false); in test_add_private_memory_region()
480 test_invalid_guest_memfd(vm, memfd, 0, "Regular memfd() should fail"); in test_add_private_memory_region()
481 close(memfd); in test_add_private_memory_region()
484 memfd = vm_create_guest_memfd(vm2, MEM_REGION_SIZE, 0); in test_add_private_memory_region()
485 test_invalid_guest_memfd(vm, memfd, 0, "Other VM's guest_memfd() should fail"); in test_add_private_memory_region()
488 MEM_REGION_GPA, MEM_REGION_SIZE, 0, memfd, in test_add_private_memory_region()
506 int memfd; test_add_overlapping_private_memory_regions() local
[all...]
/linux/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/drivers/dma-buf/
H A Dudmabuf.c272 static int check_memfd_seals(struct file *memfd) in check_memfd_seals() argument
276 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in check_memfd_seals()
279 seals = memfd_fcntl(memfd, F_GET_SEALS, 0); in check_memfd_seals()
304 static long udmabuf_pin_folios(struct udmabuf *ubuf, struct file *memfd, in udmabuf_pin_folios() argument
316 nr_folios = memfd_pin_folios(memfd, start, end, folios, pgcnt, &pgoff); in udmabuf_pin_folios()
397 struct file *memfd = fget(list[i].memfd); in udmabuf_create() local
399 if (!memfd) { in udmabuf_create()
408 inode_lock_shared(file_inode(memfd)); in udmabuf_create()
409 ret = check_memfd_seals(memfd); in udmabuf_create()
413 ret = udmabuf_pin_folios(ubuf, memfd, list[i].offset, in udmabuf_create()
[all …]
H A DKconfig40 A driver to let userspace turn memfd regions into dma-bufs.
/linux/tools/testing/selftests/bpf/prog_tests/
H A Ddmabuf_iter.c32 int dev_udmabuf, memfd, local_udmabuf; in create_udmabuf() local
39 memfd = memfd_create("memfd_test", MFD_ALLOW_SEALING); in create_udmabuf()
40 if (!ASSERT_OK_FD(memfd, "memfd_create")) in create_udmabuf()
43 if (!ASSERT_OK(ftruncate(memfd, udmabuf_test_buffer_size), "ftruncate")) in create_udmabuf()
46 if (!ASSERT_OK(fcntl(memfd, F_ADD_SEALS, F_SEAL_SHRINK), "seal")) in create_udmabuf()
54 create.memfd = memfd; in create_udmabuf()
72 close(memfd); in create_udmabuf()
/linux/tools/testing/selftests/exec/
H A Dcheck-exec.c76 int memfd, pipefd;
157 self->memfd = memfd_create("test-exec-probe", MFD_CLOEXEC); in FIXTURE_SETUP()
158 ASSERT_LE(0, self->memfd); in FIXTURE_SETUP()
160 ASSERT_EQ(0, fchmod(self->memfd, variant->file_exec ? 0700 : 0600)); in FIXTURE_SETUP()
297 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F()
300 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F()
307 fill_exec_fd(_metadata, self->memfd); in TEST_F()
309 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F()
312 test_exec_fd(_metadata, self->memfd, exec ? 0 : EACCES); in TEST_F()
73 int memfd, pipefd; FIXTURE() local
/linux/include/uapi/linux/
H A Dudmabuf.h11 __u32 memfd; member
18 __u32 memfd; member
/linux/tools/testing/selftests/kvm/x86/
H A Dprivate_mem_conversions_test.c18 #include <linux/memfd.h>
411 int memfd, i; in test_mem_conversions()
419 "The memfd size (0x%lx) needs to be cleanly divisible by the number of memslots (%u)", in test_mem_conversions()
429 memfd = vm_create_guest_memfd(vm, memfd_size, gmem_flags); in test_mem_conversions()
434 KVM_MEM_GUEST_MEMFD, memfd, slot_size * i, gmem_flags); in test_mem_conversions()
463 kvm_fallocate(memfd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 0, memfd_size); in main()
464 kvm_fallocate(memfd, FALLOC_FL_KEEP_SIZE, 0, memfd_size); in main()
466 close(memfd); in main()
383 int memfd, i; test_mem_conversions() local
/linux/tools/testing/selftests/coredump/
H A Dcoredump_worker_test.c194 int memfd; in worker_child() local
199 memfd = memfd_create("coredump_worker", 0); in worker_child()
200 if (memfd < 0 || write(memfd, "hello", 5) != 5) in worker_child()
208 sqe.fd = memfd; in worker_child()
/linux/tools/testing/selftests/drivers/net/hw/
H A Dncdevmem.c117 int memfd; member
168 ctx->memfd = memfd_create("udmabuf-test", memfd_flags); in udmabuf_alloc()
169 if (ctx->memfd < 0) { in udmabuf_alloc()
175 ret = fcntl(ctx->memfd, F_ADD_SEALS, F_SEAL_SHRINK); in udmabuf_alloc()
186 ret = ftruncate(ctx->memfd, size); in udmabuf_alloc()
194 create.memfd = ctx->memfd; in udmabuf_alloc()
215 close(ctx->memfd); in udmabuf_alloc()
227 close(ctx->memfd); in udmabuf_free()
/linux/tools/testing/selftests/memfd/
H A D.gitignore5 memfd-test-file
H A Drun_fuse_test.sh13 ./fuse_test ./mnt/memfd $@
/linux/mm/
H A Dgup.c8 #include <linux/memfd.h>
3453 * memfd_pin_folios() - pin folios associated with a memfd in memfd_pin_folios()
3454 * @memfd: the memfd whose folios are to be pinned in memfd_pin_folios()
3455 * @start: the first memfd offset in memfd_pin_folios()
3456 * @end: the last memfd offset (inclusive) in memfd_pin_folios()
3461 * Attempt to pin folios associated with a memfd in the contiguous range in memfd_pin_folios()
3462 * [start, end]. Given that a memfd is either backed by shmem or hugetlb, in memfd_pin_folios()
3478 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end, in memfd_pin_folios()
3493 if (!memfd) in memfd_pin_folios()
3436 memfd_pin_folios(struct file * memfd,loff_t start,loff_t end,struct folio ** folios,unsigned int max_folios,pgoff_t * offset) memfd_pin_folios() argument
[all...]
H A DMakefile142 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
/linux/tools/testing/selftests/ublk/
H A Dkublk.c912 * from clients. Clients send a memfd via SCM_RIGHTS; the server in ublk_handle_uring_cmd()
961 /* Receive a memfd from a client via SCM_RIGHTS */ in ublk_handle_cqe()
1034 * Handle one client connection: receive memfd, mmap it, register in ublk_thread_set_sched_affinity()
1039 int client_fd, memfd, idx, ret;
1048 memfd = ublk_shmem_recv_fd(client_fd); in ublk_batch_setup_queues()
1049 if (memfd < 0) { in ublk_batch_setup_queues()
1054 /* mmap the memfd in server address space */ in ublk_batch_setup_queues()
1055 size = lseek(memfd, 0, SEEK_END); in ublk_batch_setup_queues()
1058 close(memfd); in ublk_batch_setup_queues()
1062 MAP_SHARED | MAP_POPULATE, memfd, in ublk_batch_setup_queues()
1310 int client_fd, memfd, idx, ret; ublk_shmem_handle_client() local
[all...]
/linux/tools/testing/selftests/seccomp/
H A Dseccomp_bpf.c4173 int status, listener, memfd, fd, nextfd; in TEST()
4183 memfd = memfd_create("test", 0); in TEST()
4184 ASSERT_GE(memfd, 0); in TEST()
4185 nextfd = get_next_fd(memfd); in TEST()
4216 addfd.srcfd = memfd; in TEST()
4254 EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST()
4268 EXPECT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST()
4301 ASSERT_EQ(filecmp(getpid(), pid, memfd, fd), 0); in TEST()
4328 close(memfd); in TEST()
4394 int status, listener, memfd; in TEST()
4169 int status, listener, memfd, fd, nextfd; TEST() local
4331 int status, listener, memfd; TEST() local
[all...]
/linux/tools/testing/selftests/
H A DMakefile80 TARGETS += memfd
/linux/Documentation/arch/arm64/
H A Dmemory-tagging-extension.rst47 RAM-based file mappings (``tmpfs``, ``memfd``). Passing it to other
/linux/include/linux/
H A Dmm.h3600 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
/linux/Documentation/filesystems/
H A Dproc.rst1156 as mlocked pages, ramfs backing pages, secret memfd pages etc.
/linux/lib/
H A DKconfig.debug2944 that support live update (such as the memfd handler).
/linux/
H A DMAINTAINERS17846 F: include/linux/memfd.h
17848 F: include/uapi/linux/memfd.h
17849 F: mm/memfd.c
17852 F: tools/testing/selftests/memfd/