[PATCH v1 1/7] mm: add GFP_HIGHUSER_KASAN

sashiko-bot at kernel.org sashiko-bot at kernel.org
Mon Nov 16 15:15:19 PST 2026


> A later patch in this series adds __GFP_SKIP_KASAN to GFP_HIGHUSER, so
> that with CONFIG_KASAN_HW_TAGS its pages are neither tagged on
> allocation nor poisoned on free. That suits pages whose contents belong
> to userspace and are mapped there.
> 
> Some GFP_HIGHUSER users allocate buffers that the kernel itself fills
> and drains through kmap_local_page(), such as pipe buffers. While such
> pages are tagged, KASAN can report a linear overflow out of the page
> and an access to it while it is free.
> 
> Add GFP_HIGHUSER_KASAN for these users, so that they can be converted
> before GFP_HIGHUSER changes. It has the value GFP_HIGHUSER has today
> and will not gain __GFP_SKIP_KASAN. The two stay identical without
> CONFIG_KASAN_HW_TAGS, where __GFP_SKIP_KASAN is 0.
> 
> GFP_HIGHUSER_KASAN must not be used for memory that userspace can map
> with PROT_MTE (anonymous, shmem and hugetlb pages). Userspace sets the
> memory tags of such a page, while the kernel keeps accessing it through
> page_address() with the KASAN tag from page->flags. The two do not
> match, and kernel accesses are reported as KASAN faults. arm64 does not
> reset the tag in page->flags when the page is mapped; it relies on the
> page having been allocated with __GFP_SKIP_KASAN. Nothing checks for
> misuse at allocation or mapping time.
> 
> No functional change. The kernel-doc describes GFP_HIGHUSER as it will
> be once it skips KASAN tagging.
> 
> Assisted-by: LLM
> Signed-off-by: Jeff Xu <jeffxu at chromium.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116230627.3537051-1-jeffxu@chromium.org?part=1




More information about the kexec mailing list