[PATCH mm v3 29/38] kasan, vmalloc: add vmalloc tagging for HW_TAGS

Marco Elver elver at google.com
Tue Dec 14 11:55:58 PST 2021


On Mon, Dec 13, 2021 at 10:54PM +0100, andrey.konovalov at linux.dev wrote:
[...]
>  
> +	/*
> +	 * Skip page_alloc poisoning and zeroing for pages backing VM_ALLOC
> +	 * mappings. Only effective in HW_TAGS mode.
> +	 */
> +	gfp &= __GFP_SKIP_KASAN_UNPOISON & __GFP_SKIP_ZERO;

This will turn gfp == 0 always. Should it have been

	gfp |= __GFP_SKIP_KASAN_UNPOISON | __GFP_SKIP_ZERO

Also, not sure it matters, but on non-KASAN builds, this will now always
generate an extra instruction. You could conditionally define GFP_SKIP*
only in the KASAN modes that need them, otherwise they become 0, so the
compiler optimizes this out. (Although I think it does does complicate
GFP_SHIFT a little?)



More information about the linux-arm-kernel mailing list