Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1440445

Re: KASAN vs vmapped stacks

From Dmitry Vyukov <dvyukov@google.com>
Newsgroups linux.kernel
Subject Re: KASAN vs vmapped stacks
Date 2016-07-11 12:30 +0200
Message-ID <rTGDo-5Kn-21@gated-at.bofh.it> (permalink)
References <rTmlj-Ih-7@gated-at.bofh.it> <rTGDo-5Kn-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 11, 2016 at 11:57 AM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
>
>
> On 07/10/2016 03:47 PM, Andy Lutomirski wrote:
>> Hi all-
>>
>> I found two nasty issues with virtually mapped stacks if KASAN is
>> enabled.  The first issue is a crash: the first non-init stack is
>> allocated and accessed before KASAN initializes its zero shadow
>> AFAICT, which means that we switch to that stack and then blow up when
>> we start recursively faulting on failed accesses to the shadow.
>>
>
> KASAN initialized quite early, before any non-init task exists. The crash happens
> because non-init task writes to write-protected zero shadow.
> Currently KASAN doesn't allocate shadow memory for vmalloc addresses, we just map single
> zero page and write protect it.
>
>
>> The second issue is that, even if we survive (we initialize the zero
>> shadow on time), KASAN will fail to protect hte stack.
>>
>> For now, I just disabled use of virtually mapped stacks if KASAN is
>> on.  Do you have any easy ideas to fix it?
>>
>
> Allocate shadow memory which backs vmalloc/vmap allocations is the only way to fix this.
> I can do this, and post the patches soon enough.

Do you want to allocate it eagerly? Won't it consume 1/8 of vmalloc
range worth of physical memory?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

KASAN vs vmapped stacks Andy Lutomirski <luto@amacapital.net> - 2016-07-10 14:50 +0200
  Re: KASAN vs vmapped stacks Dmitry Vyukov <dvyukov@google.com> - 2016-07-11 10:40 +0200
    Re: KASAN vs vmapped stacks Andy Lutomirski <luto@amacapital.net> - 2016-07-11 17:00 +0200
  Re: KASAN vs vmapped stacks Dmitry Vyukov <dvyukov@google.com> - 2016-07-11 12:30 +0200
    Re: KASAN vs vmapped stacks Dmitry Vyukov <dvyukov@google.com> - 2016-07-13 12:00 +0200

csiph-web