find_vm_area(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– find_vm_area(9) πŸ’–

okay so real talk, this one's from the Kernel API Manual (yes, the Kernel API Manual, section 9, we love a niche queen πŸ‘‘) and it's honestly such a vibe check on kernel virtual memory. let's get into it bestie ✨


🌸 NAME 🌸

find_vm_area β€” find a continuous kernel virtual area

like, it goes looking for a contiguous chunk of kernel virtual address space for you. she's a detective πŸ”πŸ’…


✨ SYNOPSIS ✨

struct vm_struct * find_vm_area (const void *addr );

that's it, that's the whole signature, no cap 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • addr β€” base address. that's the starting point of the search, the address where the area begins. she starts lookin' right there πŸ’«

πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does is: search for the kernel VM area starting at addr, and return it. simple, iconic, does exactly what it says on the tin 🌈

but β€” and this is the part you cannot skip, bestie, i'm serious 😭 β€” it is up to the caller to do all required locking to keep the returned pointer valid.

⚠️ ok so like the function hands you a pointer and then just... dips πŸ’€ she does zero locking for you. if you don't take the locks yourself, that pointer can go stale on you mid-thought and then you're in undefined-behaviour territory. the locking is your main character moment, not hers. periodt.

⭐ RETURN ⭐

  • the area descriptor on success πŸ’– (struct vm_struct *, iconic)
  • or NULL on failure πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ

Kernel file ./mm/vmalloc.c β€” yes, that's the whole file reference, and here's the entire squad of vmalloc-adjacent besties she runs with:

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), 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), vread_iter(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)

go read some of those, iykyk πŸ§šβ€β™€οΈ


πŸ’Œ ok bye bestie!! this page lives in ./mm, dated October 2026, and it's filed as find_vm_area(9). mwah, go lock something before you dereference it πŸ’…πŸ’–πŸ”₯
πŸ“¦ where this page comes from