compat_set_desc_from_vma(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… compat_set_desc_from_vma(9) β€” from the Kernel API Manual, bestie ✨

Okay so buckle up, because this one is a tiny little function with a big identity crisis (affectionate). It lives in section 9 of the Kernel API Manual, and it's literally called compat_set_desc_from_vma. Let's get into it 🫢


✨ NAME ✨

compat_set_desc_from_vma β€” assigns VMA descriptor desc fields from a VMA. That's the whole job. It takes a VMA, and it fills in a descriptor from it. Iconic, efficient, no notes.


🌸 SYNOPSIS 🌸

void compat_set_desc_from_vma (struct vm_area_desc *desc , const struct
file *file , const struct vm_area_struct *vma );

Note the void β€” it gives nothing back, it just does the thing and returns. Main character energy honestly πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • desc β€” a VMA descriptor whose fields need to be set. Like, this is the glow-up target. Its fields are currently unset and we're about to fix that ✨
  • file β€” the file object describing the file being mmap'd. Yes, that file. The one you're mapping πŸ’–
  • vma β€” the VMA whose fields we wish to assign to desc. This is the source of truth, the origin story, the blueprint 🌸

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: this is a compatibility function. It exists so that an mmap hook can call mmap_prepare hooks when drivers nest these. That's the whole reason it's here β€” it's a bridge, a little social connector between two worlds 🫢

Specifically (and this is the important bit, don't skip it), it allows the construction of a vm_area_desc value, desc, from a VMA, vma, for the purposes of doing this. So: VMA goes in, descriptor comes out, nesting drivers get to talk to each other. Slay πŸ”₯

⚠️ Real talk: once the conversion of drivers is complete, this function will no longer be required and will be removed. It's on borrowed time, bestie. Don't build your whole personality around it πŸ’€

🌈 SEE ALSO 🌈

The Kernel file ./mm/util.c, plus this entire extended friend group:

kfree_const(9), __kmemdup_nul(9), kstrdup(9), kstrdup_const(9), kstrndup(9), kmemdup(9), kmemdup_array(9), kvmemdup(9), kmemdup_nul(9), memdup_user(9), vmemdup_user(9), strndup_user(9), memdup_user_nul(9), randomize_page(9), __account_locked_vm(9), account_locked_vm(9), __vmalloc_array(9), vmalloc_array(9), __vcalloc(9), vcalloc(9), folio_mapping(9), folio_copy(9), get_cmdline(9), mem_dump_obj(9), __compat_vma_mmap(9), compat_vma_mmap(9), snapshot_page(9), mmap_action_prepare(9), mmap_action_complete(9), folio_pte_batch(9), page_range_contiguous(9)

Go read them all. Or at least the compat_vma_mmap ones, they're basically siblings πŸ‘‘


Mwah πŸ’‹ this page hails from ./mm, dated October 2026, and that's the vibe check complete. Go forth and set those descriptor fields, bestie 🧚

πŸ“¦ where this page comes from