Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJu=VTqp2tzkPB4RAVxdGC+_SSQwrUwdzWpu24AA-zEcg@mail.gmail.com>
Date: Fri, 12 May 2017 14:17:19 -0700
From: Kees Cook <keescook@...omium.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Russell King - ARM Linux <linux@...linux.org.uk>, Linus Torvalds <torvalds@...ux-foundation.org>, 
	Mark Rutland <mark.rutland@....com>, 
	Kernel Hardening <kernel-hardening@...ts.openwall.com>, Greg KH <greg@...ah.com>, 
	Heiko Carstens <heiko.carstens@...ibm.com>, LKML <linux-kernel@...r.kernel.org>, 
	David Howells <dhowells@...hat.com>, Dave Hansen <dave.hansen@...el.com>, 
	"H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>, 
	Pavel Tikhomirov <ptikhomirov@...tuozzo.com>, linux-s390 <linux-s390@...r.kernel.org>, 
	"the arch/x86 maintainers" <x86@...nel.org>, Will Deacon <will.deacon@....com>, 
	Christian Borntraeger <borntraeger@...ibm.com>, René Nyffenegger <mail@...enyffenegger.ch>, 
	Catalin Marinas <catalin.marinas@....com>, "Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>, 
	Rik van Riel <riel@...hat.com>, Peter Zijlstra <a.p.zijlstra@...llo.nl>, Arnd Bergmann <arnd@...db.de>, 
	Brian Gerst <brgerst@...il.com>, Borislav Petkov <bp@...en8.de>, Andy Lutomirski <luto@...nel.org>, 
	Josh Poimboeuf <jpoimboe@...hat.com>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, 
	"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, 
	Linux API <linux-api@...r.kernel.org>, Oleg Nesterov <oleg@...hat.com>, 
	Daniel Micay <danielmicay@...il.com>, James Morse <james.morse@....com>, 
	"Eric W . Biederman" <ebiederm@...ssion.com>, Martin Schwidefsky <schwidefsky@...ibm.com>, 
	Paolo Bonzini <pbonzini@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>, 
	Thomas Garnier <thgarnie@...gle.com>, 
	"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: Re: [PATCH v9 1/4] syscalls: Verify address
 limit before returning to user-mode

On Fri, May 12, 2017 at 2:06 PM, Al Viro <viro@...iv.linux.org.uk> wrote:
> On Fri, May 12, 2017 at 09:21:06PM +0100, Russell King - ARM Linux wrote:
>> On Fri, May 12, 2017 at 12:30:02PM -0700, Kees Cook wrote:
>> > I'm clearly not explaining things well enough. I shouldn't say
>> > "corruption", I should say "malicious manipulation". The methodology
>> > of attacks against the stack are quite different from the other kinds
>> > of attacks like use-after-free, heap overflow, etc. Being able to
>> > exhaust the kernel stack (either due to deep recursion or unbounded
>> > alloca())
>>
>> I really hope we don't have alloca() use in the kernel.  Do you have
>> evidence to support that assertion?
>>
>> IMHO alloca() (or similar) should not be present in any kernel code
>> because we have a limited stack - we have kmalloc() etc for that kind
>> of thing.
>
> No alloca(), but there are VLAs.  Said that, the whole "what if they
> can bugger thread_info and/or task_struct and go after set_fs() state"
> is idiocy, of course - in that case the box is fucked, no matter what.

Two things are at risk from stack exhaustion: thread_info (mainly
addr_limit) when on the stack (fixed by THREAD_INFO_IN_TASK), and
overflow into adjacent allocations (fixed by VMAP_STACK). The latter
is fundamentally a heap overflow.

-Kees

-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.