On Tue, Dec 01, 2026 at 12:55:53PM -0600, Andrey Ryabinin wrote:
> Jeff Xu <jeff…@chromium.org> writes: >
> > /* > > * GFP_HIGHUSER (and GFP_HIGHUSER_MOVABLE derived from it) sets > > * __GFP_SKIP_KASAN to skip HW_TAGS tagging on allocation and poisoning on > > * free. These pages are meant for userspace data (e.g. anonymous and page > > * cache pages, DMA-BUF, GPU/DRM buffers) rather than kernel data structures, > > * and tagging every granule on allocation and free is expensive.
> > I think the comment should say that pages which user space > can map with PROT_MTE must not have a KASAN tag, and that __GFP_SKIP_KASAN > is what guarantees it for these allocations.
Makes sense. How does this updated comment look for v3? /* * GFP_HIGHUSER (and GFP_HIGHUSER_MOVABLE derived from it) sets * __GFP_SKIP_KASAN to skip HW_TAGS tagging on allocation and poisoning on * free. Pages that userspace can map with PROT_MTE (such as anonymous, * shmem, and HugeTLB pages) must not carry an in-kernel KASAN tag, * otherwise userspace tags will mismatch page->flags and cause KASAN false * positives; __GFP_SKIP_KASAN guarantees the match-all tag (0xff) for these * allocations. Skipping tagging also avoids expensive per-granule MTE * tagging on large userspace buffers (e.g. DMA-BUF and GPU/DRM buffers). * * Security impact: under CONFIG_KASAN_HW_TAGS, kernel accesses to these * pages via page_address() or kmap_local_page() use the match-all tag * (0xff) and lose HW_TAGS out-of-bounds and use-after-free detection. * Callers that store kernel data structures in these pages should not use * GFP_HIGHUSER. Generic and SW_TAGS KASAN are unaffected. */ Thanks, Jeff