From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Micay Subject: Re: [kernel-hardening] Re: [PATCH v9 1/4] syscalls: Verify address limit before returning to user-mode Date: Fri, 12 May 2017 17:16:44 -0400 Message-ID: <1494623804.4521.2.camel@gmail.com> References: <20170512072802.5a686f23@mschwideX1> <20170512075458.09a3a1ce@mschwideX1> <20170512202106.GO22219@n2100.armlinux.org.uk> <20170512210645.GS390@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170512210645.GS390-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Al Viro , Russell King - ARM Linux Cc: Kees Cook , Linus Torvalds , Mark Rutland , Kernel Hardening , Greg KH , Heiko Carstens , LKML , David Howells , Dave Hansen , "H . Peter Anvin" , Ingo Molnar , Pavel Tikhomirov , linux-s390 , the arch/x86 maintainers , Will Deacon , Christian Borntraeger , =?ISO-8859-1?Q?Ren=E9?= Nyffenegger , Catalin Marinas , Paul E . McKenne List-Id: linux-api@vger.kernel.org On Fri, 2017-05-12 at 22:06 +0100, Al Viro 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. VMAP_STACK + -fstack-check would prevent exploiting even an unbounded VLA / alloca size vs. it being an arbitrary write. -fstack-check guarantees that there's one byte per page as the stack grows, although there are some unfortunate GCC bugs making it less than perfect right now... but they recently started caring about it more including making it near zero overhead as it was always supposed to be.