binder_alloc_get_page(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ binder_alloc_get_page(9) β€” the Kernel API Manual glow-up πŸ¦‹

okay so this is a page from the Kernel API Manual (Linux kernel docs, we love her) and it's literally about grabbing a kernel pointer for a given buffer offset. no cap, that's the whole vibe. let's go πŸ’…


✨ NAME ✨

binder_alloc_get_page β€” get kernel pointer for given buffer offset

like… it gets you the pointer. for the offset. in the kernel. slay 🫢


🌸 SYNOPSIS 🌸

struct page * binder_alloc_get_page (struct binder_alloc *alloc , struct
binder_buffer *buffer , binder_size_t buffer_offset , pgoff_t *pgoffp );

yes bestie that's four args, and yes you need all of them 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • alloc β€” the binder_alloc for this proc. it's giving "whose memory are we even talking about" energy ✨
  • buffer β€” the binder buffer to be accessed. the main character of this whole operation ngl πŸ‘‘
  • buffer_offset β€” offset into buffer data. where inside the buffer you're pointing at πŸ“
  • pgoffp β€” address to copy final page offset to. it's the out-param, it's lowkey the messenger 🧚

πŸ’– DESCRIPTION πŸ’–

so what this does: it looks up the struct page corresponding to the address at buffer_offset into buffer->user_data. iconique behaviour honestly.

if pgoffp is not NULL, the byte-offset into the page gets written there. so it's not just a lookup, it's a lookup with a little gift for you on the side 🎁

⚠️ okay this part is mad important, do not skip it: the caller is responsible for making sure the offset points to a valid address within the buffer, and that buffer is not freeable by the user. like, that's on YOU, bestie, not on this function πŸ™ˆ

and the reasoning behind the whole rule, because it's actually so clean: since it can't be freed, we are guaranteed that the corresponding elements of alloc->pages[] cannot change. stable. consistent. periodt πŸ’€βœ¨


⭐ RETURN ⭐

struct page β€” that's it, that's the return. a struct page. no drama πŸ”₯


🌈 SEE ALSO 🌈

the whole binder_alloc friend group, we stan a supportive cast πŸ«ΆπŸ’œ


and that's the page!! brought to you by ./drivers/android, dated October 2026, titled binder_alloc_get_page(9) β€” see you in the next buffer offset bestie πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from