From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752495AbcF1TDA (ORCPT ); Tue, 28 Jun 2016 15:03:00 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:32892 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752379AbcF1TC6 (ORCPT ); Tue, 28 Jun 2016 15:02:58 -0400 From: Rasmus Villemoes 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 Subject: Re: [PATCH v1 0/2] Introduce the initify gcc plugin Organization: D03 References: <20160628133407.10c2ea1ecd194e8085e84c5a@gmail.com> <1467131708.24287.29.camel@perches.com> <1467139734.24287.45.camel@perches.com> X-Hashcash: 1:20:160628:jlayton@poochiereds.net::BODnw85QUy0Rmswf:000000000000000000000000000000000000000ISn X-Hashcash: 1:20:160628:catalin.marinas@arm.com::JBatlmG0pMXaxvHm:000000000000000000000000000000000000000IKy X-Hashcash: 1:20:160628:pageexec@freemail.hu::ElOOYL/p1xJc+LDL:000000000000000000000000000000000000000000AI8 X-Hashcash: 1:20:160628:minipli@googlemail.com::NP54oZvdYPpAbL9V:0000000000000000000000000000000000000000Zyf X-Hashcash: 1:20:160628:akpm@linux-foundation.org::9qbs/dF/CpVwoRRt:0000000000000000000000000000000000000srp X-Hashcash: 1:20:160628:linux@armlinux.org.uk::0GYS0ltPn3xajnLH:00000000000000000000000000000000000000001AS3 X-Hashcash: 1:20:160628:minipli@ld-linux.so::n3GGO0aPrhmuLf8r:0000000000000000000000000000000000000000001WeJ X-Hashcash: 1:20:160628:linux-kbuild@vger.kernel.org::WDWWYatHaveUX7qR:0000000000000000000000000000000001mWT X-Hashcash: 1:20:160628:keescook@chromium.org::F4WNvvKLPdVwMrzO:000000000000000000000000000000000000000029ld X-Hashcash: 1:20:160628:spender@grsecurity.net::PUYPbrUs0g7GJNaC:0000000000000000000000000000000000000002MiN X-Hashcash: 1:20:160628:david.brown@linaro.org::28V4TESB5YM5cofp:0000000000000000000000000000000000000002WRN X-Hashcash: 1:20:160628:joe@perches.com::uqsOjJthS6cSbd4H:0041E5 X-Hashcash: 1:20:160628:mmarek@suse.com::gMsYCEBWI9BIfxVV:003RJ3 X-Hashcash: 1:20:160628:kernel-hardening@lists.openwall.com::SSmqtdGqe/V19eCw:0000000000000000000000000045bs X-Hashcash: 1:20:160628:yamada.masahiro@socionext.com::HUZCYHZGLd5rujRQ:000000000000000000000000000000005pLG X-Hashcash: 1:20:160628:re.emese@gmail.com::1/gPgiFdwXn2W5IE:000000000000000000000000000000000000000000064ur X-Hashcash: 1:20:160628:linux-kernel@vger.kernel.org::D/zECkEXfeesiRnA:00000000000000000000000000000000063RD X-Hashcash: 1:20:160628:tglx@linutronix.de::Yc+skjyHIUdhpSQY:00000000000000000000000000000000000000000006fge X-Hashcash: 1:20:160628:arnd@arndb.de::+qOi2IajPsg82SxP:00007w3J X-Hashcash: 1:20:160628:benh@kernel.crashing.org::9VVniIaqyOL/R1WQ:0000000000000000000000000000000000000BBEB 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> 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, 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).