kmsan_alloc_page(9)
π kmsan_alloc_page β Kernel API Manual, bestie edition π
okay so this is a page from the Kernel API Manual and it's all about kmsan_alloc_page(9), and honestly? it's a tiny function doing one very specific glo-up job for KMSAN. let's get into it β¨
β¨ NAME β¨
kmsan_alloc_page β literally just a heads-up to KMSAN that somebody called alloc_pages(). that's it. that's the whole job. it's giving "notify, don't do the work" π
πΈ SYNOPSIS πΈ
void kmsan_alloc_page (struct page *page , unsigned int order , gfp_t
flags );
three args, void return, no drama. she's clean, she's simple, she's iconic π«Ά
π ARGUMENTS π
pageβ thestruct pagepointer thatalloc_pageshanded back to you. yes, the actual page. bring it as-is, don't get creative πorderβ the order of the allocatedstruct page. this is the number that decides how many pages we're talking about, so get it right bestie π₯flagsβ the GFP flags thatalloc_pageswas called with. these matter a LOT because one of them literally changes what this function does. keep reading π
π DESCRIPTION π
okay here's the tea π
KMSAN takes 1<<order pages β starting at page β and marks them all as uninitialized. every single one. no cap.
β οΈ but NOT ifflagscontain__GFP_ZERO, bestie! that's the escape hatch. if__GFP_ZEROis in there, the whole marking-as-uninitialized thing does not happen. so if you were assuming it always marks everything, nope, vibe check failed π
so like: flags has __GFP_ZERO? β we don't mark. flags doesn't have it? β 1<<order pages starting at page get marked uninitialized. periodt. π―
π₯ SEE ALSO π₯
this is the part where the page just goes OFF and links basically the entire KMSAN cinematic universe. strap in, because the list is long and every single one of these is here:
- the kernel file
./include/linux/kmsan.hβ that's where the goods live π kmsan_task_create(9)kmsan_task_exit(9)kmsan_init_shadow(9)kmsan_init_runtime(9)kmsan_memblock_free_pages(9)kmsan_free_page(9)kmsan_copy_page_meta(9)kmsan_slab_alloc(9)kmsan_slab_free(9)kmsan_kmalloc_large(9)kmsan_kfree_large(9)kmsan_ioremap_page_range(9)kmsan_iounmap_page_range(9)kmsan_handle_dma(9)kmsan_handle_dma_sg(9)kmsan_handle_urb(9)kmsan_unpoison_entry_regs(9)kmsan_get_metadata(9)kmsan_enable_current(9)kmsan_disable_current(9)memset_no_sanitize_memory(9)
likeβ¦ she really said "here's my whole friend group" and honestly we love that for her ππ
and that's the whole page!! it came to you from the source tree over at ./include/linux, dated October 2026, and it's filed under kmsan_alloc_page(9) β mwah, go mark some pages, 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