From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbcF1VGJ (ORCPT ); Tue, 28 Jun 2016 17:06:09 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:38604 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173AbcF1VGF (ORCPT ); Tue, 28 Jun 2016 17:06:05 -0400 From: Rasmus Villemoes To: Emese Revfy Cc: kernel-hardening@lists.openwall.com, pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com, keescook@chromium.org, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org, minipli@ld-linux.so, linux@armlinux.org.uk, catalin.marinas@arm.com, david.brown@linaro.org, benh@kernel.crashing.org, tglx@linutronix.de, akpm@linux-foundation.org, jlayton@poochiereds.net, arnd@arndb.de Subject: Re: [PATCH v1 1/2] Add the initify gcc plugin Organization: D03 References: <20160628133407.10c2ea1ecd194e8085e84c5a@gmail.com> <20160628133520.5baf644afca97c464b9cdb17@gmail.com> X-Hashcash: 1:20:160628:akpm@linux-foundation.org::22xINZbIgvWCJxYY:0000000000000000000000000000000000000OTw X-Hashcash: 1:20:160628:tglx@linutronix.de::/3mFEF9/dK8WXGb4:000000000000000000000000000000000000000000008e0 X-Hashcash: 1:20:160628:david.brown@linaro.org::1D9xM6E6DV3q2vLJ:0000000000000000000000000000000000000000U6b X-Hashcash: 1:20:160628:linux-kernel@vger.kernel.org::d7WG0HjAvG5LMgqN:0000000000000000000000000000000000QIT X-Hashcash: 1:20:160628:mmarek@suse.com::ArsN3A6G/zW7JjSa:0003Wj X-Hashcash: 1:20:160628:kernel-hardening@lists.openwall.com::a/ArSSz3fJzfJNxl:000000000000000000000000001JDc X-Hashcash: 1:20:160628:pageexec@freemail.hu::d3ElJsfitgBPCMdE:000000000000000000000000000000000000000002Prb X-Hashcash: 1:20:160628:catalin.marinas@arm.com::r9ELuSgt3SnvLbi/:000000000000000000000000000000000000002CdS X-Hashcash: 1:20:160628:arnd@arndb.de::DVXI5zUyXfzAtWKy:00002JEp X-Hashcash: 1:20:160628:jlayton@poochiereds.net::DWX11nywxLBYC7gj:000000000000000000000000000000000000004seh X-Hashcash: 1:20:160628:benh@kernel.crashing.org::4VFwgTTAImvAuc5i:000000000000000000000000000000000000046VA X-Hashcash: 1:20:160628:linux@armlinux.org.uk::A+hPBulD6n/KiEr4:00000000000000000000000000000000000000003EN4 X-Hashcash: 1:20:160628:minipli@ld-linux.so::a/KBPLFjimb0GQ8v:0000000000000000000000000000000000000000005B1e X-Hashcash: 1:20:160628:linux-kbuild@vger.kernel.org::tt7xJcNQClFnNf73:0000000000000000000000000000000003Qrt X-Hashcash: 1:20:160628:re.emese@gmail.com::07Iae5luR0p447Cm:00000000000000000000000000000000000000000004X/L X-Hashcash: 1:20:160628:keescook@chromium.org::nirGjGGyBHgbPmaI:00000000000000000000000000000000000000008F5x X-Hashcash: 1:20:160628:spender@grsecurity.net::8W7ZqriMuWvkiVVp:0000000000000000000000000000000000000009N7c X-Hashcash: 1:20:160628:yamada.masahiro@socionext.com::iz1GU61zZejr+rAk:00000000000000000000000000000000DqDZ Date: Tue, 28 Jun 2016 23:05:56 +0200 In-Reply-To: <20160628133520.5baf644afca97c464b9cdb17@gmail.com> (Emese Revfy's message of "Tue, 28 Jun 2016 13:35:20 +0200") Message-ID: <87vb0tgh1n.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 28 2016, Emese Revfy wrote: > The kernel already has a mechanism to free up code and data memory that > is only used during kernel or module initialization. > This plugin will teach the compiler to find more such code and data that > can be freed after initialization. > It has two passes. The first one tries to find all functions that > can be become __init/__exit. The second one moves string constants > (local variables and function string arguments marked by > the nocapture attribute) only referenced in __init/__exit functions > to the __initconst/__exitconst sections. > It reduces memory usage. This plugin can be useful for embedded systems. May I suggest, as a followup patch, a debug option/plugin parameter to put the strings in a section which will not be reaped after init, but just marked inaccessible, with graceful handling of bad accesses (print a big fat warning, make the page(s) readable, continue)? Rasmus From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com From: Rasmus Villemoes References: <20160628133407.10c2ea1ecd194e8085e84c5a@gmail.com> <20160628133520.5baf644afca97c464b9cdb17@gmail.com> Date: Tue, 28 Jun 2016 23:05:56 +0200 In-Reply-To: <20160628133520.5baf644afca97c464b9cdb17@gmail.com> (Emese Revfy's message of "Tue, 28 Jun 2016 13:35:20 +0200") Message-ID: <87vb0tgh1n.fsf@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain Subject: [kernel-hardening] Re: [PATCH v1 1/2] Add the initify gcc plugin To: Emese Revfy Cc: kernel-hardening@lists.openwall.com, pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com, keescook@chromium.org, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org, minipli@ld-linux.so, linux@armlinux.org.uk, catalin.marinas@arm.com, david.brown@linaro.org, benh@kernel.crashing.org, tglx@linutronix.de, akpm@linux-foundation.org, jlayton@poochiereds.net, arnd@arndb.de List-ID: On Tue, Jun 28 2016, Emese Revfy wrote: > The kernel already has a mechanism to free up code and data memory that > is only used during kernel or module initialization. > This plugin will teach the compiler to find more such code and data that > can be freed after initialization. > It has two passes. The first one tries to find all functions that > can be become __init/__exit. The second one moves string constants > (local variables and function string arguments marked by > the nocapture attribute) only referenced in __init/__exit functions > to the __initconst/__exitconst sections. > It reduces memory usage. This plugin can be useful for embedded systems. May I suggest, as a followup patch, a debug option/plugin parameter to put the strings in a section which will not be reaped after init, but just marked inaccessible, with graceful handling of bad accesses (print a big fat warning, make the page(s) readable, continue)? Rasmus