Home
last modified time | relevance | path

Searched refs:memfd (Results 1 – 21 of 21) 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.c465 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 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.c291 static int check_memfd_seals(struct file *memfd) in check_memfd_seals() argument
295 if (!shmem_file(memfd) && !is_file_hugepages(memfd)) in check_memfd_seals()
298 seals = memfd_fcntl(memfd, F_GET_SEALS, 0); in check_memfd_seals()
323 static long udmabuf_pin_folios(struct udmabuf *ubuf, struct file *memfd, in udmabuf_pin_folios() argument
335 nr_folios = memfd_pin_folios(memfd, start, end, folios, pgcnt, &pgoff); in udmabuf_pin_folios()
416 struct file *memfd = fget(list[i].memfd); in udmabuf_create() local
418 if (!memfd) { in udmabuf_create()
427 inode_lock_shared(file_inode(memfd)); in udmabuf_create()
428 ret = check_memfd_seals(memfd); in udmabuf_create()
432 ret = udmabuf_pin_folios(ubuf, memfd, list[i].offset, in udmabuf_create()
[all …]
/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.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/mm/
H A Dmemfd.c67 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument
73 if (is_file_hugepages(memfd)) { in memfd_alloc_folio()
80 struct inode *inode = file_inode(memfd); in memfd_alloc_folio()
81 struct hstate *h = hstate_file(memfd); in memfd_alloc_folio()
119 hash = hugetlb_fault_mutex_hash(memfd->f_mapping, idx); in memfd_alloc_folio()
123 memfd->f_mapping, in memfd_alloc_folio()
143 return shmem_read_folio(memfd->f_mapping, idx); in memfd_alloc_folio()
H A Dgup.c8 #include <linux/memfd.h>
3411 * memfd_pin_folios() - pin folios associated with a memfd in pin_user_pages_unlocked()
3412 * @memfd: the memfd whose folios are to be pinned in pin_user_pages_unlocked()
3413 * @start: the first memfd offset in pin_user_pages_unlocked()
3414 * @end: the last memfd offset (inclusive) in pin_user_pages_unlocked()
3419 * Attempt to pin folios associated with a memfd in the contiguous range
3420 * [start, end]. Given that a memfd is either backed by shmem or hugetlb,
3436 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
3451 if (!memfd) in memfd_pin_folios()
3447 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 DMakefile143 obj-$(CONFIG_MEMFD_CREATE) += memfd.o
/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.c383 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/include/linux/
H A Dmemfd.h11 struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx);
26 static inline struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx) in memfd_alloc_folio() argument
H A Dmm.h2995 long memfd_pin_folios(struct file *memfd, loff_t start, loff_t end,
/linux/tools/testing/selftests/drivers/net/hw/
H A Dncdevmem.c112 int memfd; member
158 ctx->memfd = memfd_create("udmabuf-test", MFD_ALLOW_SEALING); in udmabuf_alloc()
159 if (ctx->memfd < 0) { in udmabuf_alloc()
164 ret = fcntl(ctx->memfd, F_ADD_SEALS, F_SEAL_SHRINK); in udmabuf_alloc()
170 ret = ftruncate(ctx->memfd, size); in udmabuf_alloc()
178 create.memfd = ctx->memfd; in udmabuf_alloc()
199 close(ctx->memfd); in udmabuf_alloc()
211 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/tools/testing/selftests/seccomp/
H A Dseccomp_bpf.c4137 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 DMakefile62 TARGETS += memfd
/linux/Documentation/arch/arm64/
H A Dmemory-tagging-extension.rst47 RAM-based file mappings (``tmpfs``, ``memfd``). Passing it to other
/linux/lib/
H A DKconfig.debug2890 that support live update (such as the memfd handler).
/linux/
H A DMAINTAINERS26670 F: include/linux/memfd.h
26672 F: mm/memfd.c