[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+Zr70+xJUGGDzih09ELG2+SFRKuH9Asvyeo0+RWPT3sKw@mail.gmail.com>
Date: Wed, 24 Aug 2016 09:11:58 -0700
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Andy Lutomirski <luto@...nel.org>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
"x86@...nel.org" <x86@...nel.org>, Borislav Petkov <bp@...en8.de>,
LKML <linux-kernel@...r.kernel.org>,
Brian Gerst <brgerst@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH v6 1/3] fork: Add generic vmalloced stack support
On Wed, Aug 24, 2016 at 3:03 AM, Ingo Molnar <mingo@...nel.org> wrote:
>
> * Andy Lutomirski <luto@...nel.org> wrote:
>
>> +config VMAP_STACK
>> + default y
>> + bool "Use a virtually-mapped stack"
>> + depends on HAVE_ARCH_VMAP_STACK && !KASAN
>> + ---help---
>> + Enable this if you want the use virtually-mapped kernel stacks
>> + with guard pages. This causes kernel stack overflows to be
>> + caught immediately rather than causing difficult-to-diagnose
>> + corruption.
>> +
>> + This is presently incompatible with KASAN because KASAN expects
>> + the stack to map directly to the KASAN shadow map using a formula
>> + that is incorrect if the stack is in vmalloc space.
>
> Btw., is this KASAN limitation fundamental?
>
> As x86 is going to enable this feature by default, this probably limits KASAN
> utility rather significantly.
No, it's not fundamental.
KASAN has shadow for vmalloc range, but currently we map a single
read-only zero page there (which means "this memory is good"). Stack
instrumentation tries to write to that read-only page, which causes
crash.
Andrey proposed that we can map some real writable pages in the shadow
range when we allocate a vmalloc-ed stack:
https://groups.google.com/d/msg/kasan-dev/0YxqFs9r0V8/OKoGHQL8BAAJ
Powered by blists - more mailing lists