modify_prot_commit_ptes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ modify_prot_commit_ptes β€” the modify_prot_commit_ptes(9) glow-up πŸŽ€

okay so bestie, this is a page from the Kernel API Manual, and it's literally about committing a pte update to a whole batch of ptes while leaving any hardware-controlled bits in the PTE untouched πŸ’… (yes, untouched β€” the hardware keeps its toys, we don't touch them, periodt).


✨ SYNOPSIS ✨

void modify_prot_commit_ptes (struct vm_area_struct *vma , unsigned long
addr , pte_t *ptep , pte_t old_pte , pte_t pte , unsigned int nr );

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


🌸 ARGUMENTS 🌸

  • vma β€” the virtual memory area these pages are mapped into. it's giving "where do these pages even live" energy.
  • addr β€” the address the first page is mapped at. first page gets the honors πŸ‘‘
  • ptep β€” page table pointer for the first entry. your starting point, iykyk.
  • old_pte β€” the old page table entry (for the first entry) which is now cleared. it's had its moment, now it's gone πŸ’€
  • pte β€” the new page table entry to be set. the main character, fr fr.
  • nr β€” number of entries. how many ptes are we doing this to, bestie.

πŸ¦‹ DESCRIPTION πŸ¦‹

May be overridden by the architecture β€” so some arches are out here doing their own thing 🧚. Otherwise, it's implemented as a simple loop over ptep_modify_prot_commit. simple loop, simple life, lowkey iconic.


πŸ”₯ CONTEXT πŸ”₯

okay so the important stuff, listen up:

The caller holds the page table lock πŸ”’. The PTEs are all in the same PMD. On exit, the set ptes in the batch map the same folio.

and here's the part you cannot miss: the ptes set by ptep_modify_prot_start may additionally have young and/or dirty bits set where previously they were not, so the updated ptes may have these additional changes ✨. not me warning you about extra bits showing up uninvited πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ

Kernel file ./include/linux/pgtable.h and its whole friend group:


bestie reminder: the commit is the second half of the party β€” modify_prot_start_ptes(9) is the pregame, this one's the drop πŸ”₯

omg okay that's the whole thing, you ate that πŸ“ this lil gem lives in ./include/linux and the manual says October 2026 β€” so like, future icons only πŸ‘‘βœ¨ slay, go commit some ptes, mwah πŸ’–

πŸ“¦ where this page comes from