All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Joe Perches <joe@perches.com>
Cc: Emese Revfy <re.emese@gmail.com>,
	kernel-hardening@lists.openwall.com,
	Mathias Krause <minipli@googlemail.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 0/2] Introduce the initify gcc plugin
Date: Tue, 28 Jun 2016 21:02:54 +0200	[thread overview]
Message-ID: <87h9cdi1b5.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <1467139734.24287.45.camel@perches.com> (Joe Perches's message of "Tue, 28 Jun 2016 11:48:54 -0700")

On Tue, Jun 28 2016, Joe Perches <joe@perches.com> 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).

WARNING: multiple messages have this Message-ID (diff)
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Joe Perches <joe@perches.com>
Cc: Emese Revfy <re.emese@gmail.com>,
	kernel-hardening@lists.openwall.com,
	Mathias Krause <minipli@googlemail.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: [kernel-hardening] Re: [PATCH v1 0/2] Introduce the initify gcc plugin
Date: Tue, 28 Jun 2016 21:02:54 +0200	[thread overview]
Message-ID: <87h9cdi1b5.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <1467139734.24287.45.camel@perches.com> (Joe Perches's message of "Tue, 28 Jun 2016 11:48:54 -0700")

On Tue, Jun 28 2016, Joe Perches <joe@perches.com> 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).

  reply	other threads:[~2016-06-28 19:03 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 11:34 [PATCH v1 0/2] Introduce the initify gcc plugin Emese Revfy
2016-06-28 11:34 ` [kernel-hardening] " Emese Revfy
2016-06-28 11:35 ` [PATCH v1 1/2] Add " Emese Revfy
2016-06-28 11:35   ` [kernel-hardening] " Emese Revfy
2016-06-28 21:05   ` Rasmus Villemoes
2016-06-28 21:05     ` [kernel-hardening] " Rasmus Villemoes
2016-06-29 14:50     ` Kees Cook
2016-06-29 14:50       ` [kernel-hardening] " Kees Cook
2016-06-29 14:50       ` Kees Cook
2016-06-29 19:03     ` Emese Revfy
2016-06-29 19:03       ` [kernel-hardening] " Emese Revfy
2016-06-28 11:36 ` [PATCH v1 2/2] Mark functions with the __nocapture attribute Emese Revfy
2016-06-28 11:36   ` [kernel-hardening] " Emese Revfy
2016-06-28 16:43   ` Joe Perches
2016-06-28 16:43     ` [kernel-hardening] " Joe Perches
2016-06-28 20:40     ` Emese Revfy
2016-06-28 20:40       ` [kernel-hardening] " Emese Revfy
2016-06-28 21:00       ` Joe Perches
2016-06-28 21:00         ` [kernel-hardening] " Joe Perches
2016-06-29 18:42         ` Emese Revfy
2016-06-29 18:42           ` [kernel-hardening] " Emese Revfy
2016-06-30  0:12           ` Joe Perches
2016-06-30  0:12             ` [kernel-hardening] " Joe Perches
2016-07-01 14:03             ` Emese Revfy
2016-07-01 14:03               ` [kernel-hardening] " Emese Revfy
2016-06-28 20:50   ` Rasmus Villemoes
2016-06-28 20:50     ` [kernel-hardening] " Rasmus Villemoes
2016-06-28 21:38     ` PaX Team
2016-06-28 21:38       ` [kernel-hardening] " PaX Team
2016-06-28 22:41       ` Rasmus Villemoes
2016-06-28 22:41         ` [kernel-hardening] " Rasmus Villemoes
2016-06-29 18:39     ` Emese Revfy
2016-06-29 18:39       ` [kernel-hardening] " Emese Revfy
2016-06-28 11:42 ` [PATCH v1 0/2] Introduce the initify gcc plugin Emese Revfy
2016-06-28 11:42   ` [kernel-hardening] " Emese Revfy
2016-06-28 12:57 ` [kernel-hardening] " Mark Rutland
2016-06-28 16:14   ` Emese Revfy
2016-06-28 20:46     ` Kees Cook
2016-06-28 20:46       ` Kees Cook
2016-06-29  8:21       ` Mark Rutland
2016-06-29  8:21         ` Mark Rutland
2016-06-29 17:52         ` Mark Rutland
2016-06-29 17:52           ` Mark Rutland
2016-06-29 18:28           ` Emese Revfy
2016-06-29 18:28             ` Emese Revfy
2016-06-28 16:35 ` Joe Perches
2016-06-28 16:35   ` [kernel-hardening] " Joe Perches
2016-06-28 18:48   ` Joe Perches
2016-06-28 18:48     ` [kernel-hardening] " Joe Perches
2016-06-28 19:02     ` Rasmus Villemoes [this message]
2016-06-28 19:02       ` Rasmus Villemoes
2016-06-28 20:29       ` Emese Revfy
2016-06-28 20:29         ` [kernel-hardening] " Emese Revfy
2016-06-28 17:00 ` Mathias Krause
2016-06-28 17:00   ` [kernel-hardening] " Mathias Krause
2016-06-28 20:29   ` Emese Revfy
2016-06-28 20:29     ` [kernel-hardening] " Emese Revfy
2016-06-28 21:49 ` Joe Perches
2016-06-28 21:49   ` [kernel-hardening] " Joe Perches
2016-06-28 22:07   ` Valdis.Kletnieks
2016-06-28 23:54     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9cdi1b5.fsf@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=david.brown@linaro.org \
    --cc=jlayton@poochiereds.net \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=minipli@googlemail.com \
    --cc=minipli@ld-linux.so \
    --cc=mmarek@suse.com \
    --cc=pageexec@freemail.hu \
    --cc=re.emese@gmail.com \
    --cc=spender@grsecurity.net \
    --cc=tglx@linutronix.de \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.