[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZfP+j6ra4vExsOg96yVHTHQy_NB65-TT=S=9Gr1X62yiA@mail.gmail.com>
Date: Tue, 14 Dec 2021 20:42:00 +0100
From: Andrey Konovalov <andreyknvl@...il.com>
To: andrey.konovalov@...ux.dev
Cc: Marco Elver <elver@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux Memory Management List <linux-mm@...ck.org>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Peter Collingbourne <pcc@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: Re: [PATCH mm v3 30/38] kasan, vmalloc: don't tag executable vmalloc allocations
On Mon, Dec 13, 2021 at 10:54 PM <andrey.konovalov@...ux.dev> 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
>
Powered by blists - more mailing lists