From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com ([74.125.82.45]:32892 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbcF1TC6 (ORCPT ); Tue, 28 Jun 2016 15:02:58 -0400 Received: by mail-wm0-f45.google.com with SMTP id r190so29045694wmr.0 for ; Tue, 28 Jun 2016 12:02:57 -0700 (PDT) From: Rasmus Villemoes Subject: Re: [PATCH v1 0/2] Introduce the initify gcc plugin References: <20160628133407.10c2ea1ecd194e8085e84c5a@gmail.com> <1467131708.24287.29.camel@perches.com> <1467139734.24287.45.camel@perches.com> Date: Tue, 28 Jun 2016 21:02:54 +0200 In-Reply-To: <1467139734.24287.45.camel@perches.com> (Joe Perches's message of "Tue, 28 Jun 2016 11:48:54 -0700") Message-ID: <87h9cdi1b5.fsf@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Joe Perches Cc: Emese Revfy , kernel-hardening@lists.openwall.com, Mathias Krause , 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, Joe Perches wrote: >> What happens to string deduplication when one string >> is in an init function and the same string is also used >> in a non-init function in the same compilation unit? >> >> foo.c >> >> __init void initfunc(void) >> { >> pr_info("%s: I'm here\n", __func__); >> } >> >> void runtimefunc(void) >> { >> pr_info("I'm here: %s\n", __func__); >> } >> >> In what section does the string "I'm here: %s\n" get placed >> or does it get placed into multiple sections? It'll get placed in multiple sections by the compiler, and nothing bad happens. String deduplication is something the linker does to sections equipped with appropriate flags. So in this case that of course means that the kernel image itself would be slightly bigger, while the used data after init would be the same. But I don't think there's a lot of these cases. (Also, "initfunc" would at least vanish).