Re: [PATCH mm v3 30/38] kasan, vmalloc: don't tag executable vmalloc allocations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 13, 2021 at 10:54 PM <andrey.konovalov@xxxxxxxxx> wrote:
>

[...]

> @@ -3133,10 +3133,14 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
>          * (except for the should_skip_init() check) to make sure that memory
>          * is initialized under the same conditions regardless of the enabled
>          * KASAN mode.
> +        * Tag-based KASAN modes only assign tags to non-executable
> +        * allocations, see __kasan_unpoison_vmalloc().
>          */
>         kasan_flags = KASAN_VMALLOC_VM_ALLOC;
>         if (!want_init_on_free() && want_init_on_alloc(gfp_mask))
>                 kasan_flags |= KASAN_VMALLOC_INIT;
> +       if (pgprot_val(prot) == pgprot_val(pgprot_nx(prot)))

Can simply compare with PAGE_KERNEL here to match the check in
arch_vmalloc_pgprot_modify(). Will do in v4.

> +               kasan_flags |= KASAN_VMALLOC_NOEXEC;
>         addr = kasan_unpoison_vmalloc(addr, real_size, kasan_flags);
>
>         /*
> @@ -3844,7 +3848,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
>         for (area = 0; area < nr_vms; area++)
>                 vms[area]->addr = kasan_unpoison_vmalloc(vms[area]->addr,
>                                                          vms[area]->size,
> -                                                        KASAN_VMALLOC_NONE);
> +                                                        KASAN_VMALLOC_NOEXEC);
>
>         kfree(vas);
>         return vms;
> --
> 2.25.1
>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux