From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com ([74.125.82.43]:38604 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752226AbcF1VGH (ORCPT ); Tue, 28 Jun 2016 17:06:07 -0400 Received: by mail-wm0-f43.google.com with SMTP id r201so45242302wme.1 for ; Tue, 28 Jun 2016 14:06:04 -0700 (PDT) From: Rasmus Villemoes Subject: Re: [PATCH v1 1/2] Add the initify gcc plugin 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 Sender: linux-kbuild-owner@vger.kernel.org List-ID: 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 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