|
Message-ID: <CA+DvKQJrqk6hBKkN3eObgnAwy6i1QjHOBt-LvfjV7nL4m6aJYw@mail.gmail.com> Date: Tue, 6 Mar 2018 10:28:22 -0500 From: Daniel Micay <danielmicay@...il.com> To: Ingo Molnar <mingo@...nel.org> Cc: Kees Cook <keescook@...omium.org>, Linus Torvalds <torvalds@...ux-foundation.org>, Dave Hansen <dave.hansen@...ux.intel.com>, Alexander Popov <alex.popov@...ux.com>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, PaX Team <pageexec@...email.hu>, Brad Spengler <spender@...ecurity.net>, Andy Lutomirski <luto@...nel.org>, Tycho Andersen <tycho@...ho.ws>, Laura Abbott <labbott@...hat.com>, Mark Rutland <mark.rutland@....com>, Ard Biesheuvel <ard.biesheuvel@...aro.org>, Borislav Petkov <bp@...en8.de>, Richard Sandiford <richard.sandiford@....com>, Thomas Gleixner <tglx@...utronix.de>, "H . Peter Anvin" <hpa@...or.com>, Peter Zijlstra <a.p.zijlstra@...llo.nl>, "Dmitry V . Levin" <ldv@...linux.org>, Emese Revfy <re.emese@...il.com>, Jonathan Corbet <corbet@....net>, Andrey Ryabinin <aryabinin@...tuozzo.com>, "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>, Thomas Garnier <thgarnie@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>, Alexei Starovoitov <ast@...nel.org>, Josef Bacik <jbacik@...com>, Masami Hiramatsu <mhiramat@...nel.org>, Nicholas Piggin <npiggin@...il.com>, Al Viro <viro@...iv.linux.org.uk>, "David S . Miller" <davem@...emloft.net>, Ding Tianhong <dingtianhong@...wei.com>, David Woodhouse <dwmw@...zon.co.uk>, Josh Poimboeuf <jpoimboe@...hat.com>, Steven Rostedt <rostedt@...dmis.org>, Dominik Brodowski <linux@...inikbrodowski.net>, Juergen Gross <jgross@...e.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Dan Williams <dan.j.williams@...el.com>, Mathias Krause <minipli@...glemail.com>, Vikas Shivappa <vikas.shivappa@...ux.intel.com>, Kyle Huey <me@...ehuey.com>, Dmitry Safonov <dsafonov@...tuozzo.com>, Will Deacon <will.deacon@....com>, Arnd Bergmann <arnd@...db.de>, X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org> Subject: Re: [PATCH RFC v9 4/7] x86/entry: Erase kernel stack in syscall_trace_enter() The kernel could use -Werror=vla-larger-than=2048 as a stop-gap and work around all the errors by making sure it can't be larger and reporting an error or adding `BUG_ON(size > limit)` to prove it to the compiler if necessary. It warns if the VLA *can be* larger than the limit, unlike the frame size warning the kernel uses only warning when the frame is *guaranteed* to be larger than the limit. It wouldn't be a guaranteed to work solution since a function can have other VLAs, etc. but in practice it could probably be good enough. I've tried it and I don't think it would be that much work. It might save someone from a vulnerability that isn't using VMAP_STACK even if the issue gets fixed for that. Android kernels are likely mostly going to be compiled with Clang now for 4.4+ and it doesn't have a similar warning though. I mentioned last year that there were some real vulnerabilities caused by unbounded VLAs: http://openwall.com/lists/kernel-hardening/2017/05/12/33. It's fairly easy to flip up and accidentally use one especially for people that work with other languages. Maybe the kernel should already be using -Werror=vla and overriding it for the few cases that exist to stop letting people introduce more.
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.