vread_iter(9)
π vread_iter(9) β the Kernel API Manual page you didn't know you needed
okay so first things first: this is a page from the Kernel API Manual, section 9, and it's about vread_iter. it's lowkey niche but it's giving "trusted gatekeeper of vmalloc" energy and i'm obsessed π
β¨ NAME β¨
vread_iter β read vmalloc area in a safe way to an iterator.
like, safely. no cap. π¦
πΈ SYNOPSIS πΈ
long vread_iter (struct iov_iter *iter , const char *addr , size_t count
);
she returns a long, she takes three things, she's an icon π
π ARGUMENTS π
iterβ the iterator to which data should be written. yeah, "read" function, "written" arg, that's just how she rolls πaddrβ the vm address. the starting point. the main character of the address space β¨countβ number of bytes to be read. the vibes-per-byte budget π
π DESCRIPTION π
so here's the tea β this function first does a vibe check on addr β it checks that addr is a valid vmalloc'ed area, and then copies data from that area into the given iterator.
if the memory range [addr...addr+count) includes some valid address, the data gets copied to the proper area of iter. slay. but if there are memory holes, those get zero-filled β no drama, just zeroes π
and a IOREMAP area? treated as a memory hole, and no copy is done. she said "not my problem, bestie" π
ββοΈ
also, if [addr...addr+count) doesn't include any intersection with an alive vm_struct area, it returns 0. periodt.
π«Ά NOTE π«Ά
genuinely important one, so listen up π In usual ops, vread_iter is never necessary, because the caller should know the vmalloc area is valid and can just use memcpy. fr fr.
this one is for routines which have to access vmalloc area without any information, as /proc/kcore. she's the emergency contact of the vmalloc world π
β RETURN β
she returns the number of bytes for which addr and iter should be advanced (same number as count) β or 0 if [addr...addr+count) doesn't include any intersection with a valid vmalloc area. simple, honest, iconic π
π¦ SEE ALSO π¦
Kernel file ./mm/vmalloc.c and honestly her whole friend group:
vunmap_range(9)vmap_pages_range(9)vm_area_map_pages(9)vm_area_unmap_pages(9)new_vmap_block(9)vm_unmap_aliases(9)vm_unmap_ram(9)vm_map_ram(9)vm_area_add_early(9)vm_area_register_early(9)get_vm_area(9)find_vm_area(9)remove_vm_area(9)vfree_atomic(9)vfree(9)vunmap(9)vmap(9)vmap_pfn(9)__vmalloc_node_range(9)__vmalloc_node(9)vmalloc(9)vmalloc_huge_node(9)vzalloc(9)vmalloc_user(9)vmalloc_node(9)vzalloc_node(9)vrealloc_node_align(9)vmalloc_32(9)vmalloc_32_user(9)remap_vmalloc_range_partial(9)remap_vmalloc_range(9)pvm_find_va_enclose_addr(9)pvm_determine_end_from_reverse(9)pcpu_get_vm_areas(9)pcpu_free_vm_areas(9)
that's the whole group chat, no one's getting left on read π
and that's the page!! mwah π this lil slice of the Kernel API Manual comes to you from ./mm, dated October 2026, page vread_iter(9) β go read some vmalloc, bestie, you got this π§β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms