All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Alexander Potapenko <glider@google.com>,
	"x86@kernel.org" <x86@kernel.org>, Borislav Petkov <bp@alien8.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Brian Gerst <brgerst@gmail.com>, Oleg Nesterov <oleg@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH v6 1/3] fork: Add generic vmalloced stack support
Date: Wed, 24 Aug 2016 09:11:58 -0700	[thread overview]
Message-ID: <CACT4Y+Zr70+xJUGGDzih09ELG2+SFRKuH9Asvyeo0+RWPT3sKw@mail.gmail.com> (raw)
In-Reply-To: <20160824100352.GA9681@gmail.com>

On Wed, Aug 24, 2016 at 3:03 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Andy Lutomirski <luto@kernel.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

  reply	other threads:[~2016-08-24 16:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11  9:35 [PATCH v6 0/3] virtually mapped stacks Andy Lutomirski
2016-08-11  9:35 ` [PATCH v6 1/3] fork: Add generic vmalloced stack support Andy Lutomirski
2016-08-15 11:55   ` Michal Hocko
2016-08-24 10:03   ` Ingo Molnar
2016-08-24 16:11     ` Dmitry Vyukov [this message]
2016-08-24 13:02   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-08-24 16:51   ` [PATCH v6 1/3] " Josh Cartwright
2016-08-30 22:01     ` Andy Lutomirski
2016-08-30 22:26       ` Josh Cartwright
2016-08-11  9:35 ` [PATCH v6 2/3] dma-api: Teach the "DMA-from-stack" check about vmapped stacks Andy Lutomirski
2016-08-24 13:02   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-08-11  9:35 ` [PATCH v6 3/3] x86/mm/64: Enable " Andy Lutomirski
2016-08-24 13:03   ` [tip:x86/asm] x86/mm/64: Enable vmapped stacks (CONFIG_HAVE_ARCH_VMAP_STACK=y) tip-bot for Andy Lutomirski
2016-10-21 12:32     ` Matt Fleming
2016-10-21 12:32       ` Matt Fleming
2016-10-22  0:18       ` Andy Lutomirski
2016-10-22  0:18         ` Andy Lutomirski
2016-10-24 13:09         ` Matt Fleming
2016-10-24 13:09           ` Matt Fleming
2016-10-30 16:21           ` Andy Lutomirski
2016-10-30 16:21             ` Andy Lutomirski
2016-11-07 12:32             ` Matt Fleming
2016-11-07 12:32               ` Matt Fleming
2016-08-20 18:06 ` [PATCH v6 0/3] virtually mapped stacks Andy Lutomirski
2016-08-24 10:12   ` Ingo Molnar
2016-08-24 15:27     ` Andy Lutomirski
2016-08-24 17:16       ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACT4Y+Zr70+xJUGGDzih09ELG2+SFRKuH9Asvyeo0+RWPT3sKw@mail.gmail.com \
    --to=dvyukov@google.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=glider@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.