binder_alloc_get_page(9)
π¦ 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β thebinder_allocfor 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 π
- Kernel file
./drivers/android/binder_alloc.c binder_alloc_prepare_to_free(9)binder_alloc_new_buf(9)binder_alloc_clear_buf(9)binder_alloc_free_buf(9)binder_alloc_mmap_handler(9)binder_alloc_print_allocated(9)binder_alloc_print_pages(9)binder_alloc_get_allocated_count(9)binder_alloc_vma_close(9)binder_alloc_free_page(9)binder_alloc_init(9)check_buffer(9)binder_alloc_copy_user_to_buffer(9)
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
- 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