From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbdBIK1d (ORCPT ); Thu, 9 Feb 2017 05:27:33 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:53125 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751960AbdBIK1a (ORCPT ); Thu, 9 Feb 2017 05:27:30 -0500 Date: Thu, 9 Feb 2017 11:27:03 +0100 From: Peter Zijlstra To: Kees Cook Cc: Mark Rutland , "Reshetova, Elena" , Greg KH , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Will Deacon , David Windsor , Hans Liljestrand , David Howells , LKML , "kernel-hardening@lists.openwall.com" Subject: Re: [kernel-hardening] Re: [PATCH 4/4] refcount: Report failures through CHECK_DATA_CORRUPTION Message-ID: <20170209102703.GB6500@twins.programming.kicks-ass.net> References: <20170207083405.GV6500@twins.programming.kicks-ass.net> <20170207111011.GB28790@leverpostej> <20170207123630.GR6515@twins.programming.kicks-ass.net> <20170207135020.GA26173@leverpostej> <20170207150737.GM25813@worktop.programming.kicks-ass.net> <20170207160300.GB26173@leverpostej> <20170207173036.GS6515@twins.programming.kicks-ass.net> <20170207175542.GC26173@leverpostej> <20170208091250.GT6515@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 08, 2017 at 01:20:26PM -0800, Kees Cook wrote: > Ooooh, that is intense. And the trampolines (EX_REG_HANDLERs) are all > just there to catch whatever register gcc decides to stuff the value > into? *cover face* Sure, okay. :) Right, they shouldn't be big functions, but barring whole program LTO there's just no knowing which are unused. > I wonder how many existing WARN callsites could be repurposed to use this? At the very least all WARN/BUG instances with trivial @format argument that are inlined I think. For example, things like: static inline some_function() { /* ... */ WARN(cond, "blah blah blah\n"); /* ... */ } where the format has no arguments. Here we can out-of-line the printk() stuff, which, as is the purpose here, shrinks the size of the inline. From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 9 Feb 2017 11:27:03 +0100 From: Peter Zijlstra Message-ID: <20170209102703.GB6500@twins.programming.kicks-ass.net> References: <20170207083405.GV6500@twins.programming.kicks-ass.net> <20170207111011.GB28790@leverpostej> <20170207123630.GR6515@twins.programming.kicks-ass.net> <20170207135020.GA26173@leverpostej> <20170207150737.GM25813@worktop.programming.kicks-ass.net> <20170207160300.GB26173@leverpostej> <20170207173036.GS6515@twins.programming.kicks-ass.net> <20170207175542.GC26173@leverpostej> <20170208091250.GT6515@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [kernel-hardening] Re: [PATCH 4/4] refcount: Report failures through CHECK_DATA_CORRUPTION To: Kees Cook Cc: Mark Rutland , "Reshetova, Elena" , Greg KH , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Will Deacon , David Windsor , Hans Liljestrand , David Howells , LKML , "kernel-hardening@lists.openwall.com" List-ID: On Wed, Feb 08, 2017 at 01:20:26PM -0800, Kees Cook wrote: > Ooooh, that is intense. And the trampolines (EX_REG_HANDLERs) are all > just there to catch whatever register gcc decides to stuff the value > into? *cover face* Sure, okay. :) Right, they shouldn't be big functions, but barring whole program LTO there's just no knowing which are unused. > I wonder how many existing WARN callsites could be repurposed to use this? At the very least all WARN/BUG instances with trivial @format argument that are inlined I think. For example, things like: static inline some_function() { /* ... */ WARN(cond, "blah blah blah\n"); /* ... */ } where the format has no arguments. Here we can out-of-line the printk() stuff, which, as is the purpose here, shrinks the size of the inline.