All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Emese Revfy <re.emese@gmail.com>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	PaX Team <pageexec@freemail.hu>,
	Brad Spengler <spender@grsecurity.net>,
	Michal Marek <mmarek@suse.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	minipli@ld-linux.so, Catalin Marinas <catalin.marinas@arm.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	David Brown <david.brown@linaro.org>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jeff Layton <jlayton@poochiereds.net>,
	Arnd Bergmann <arnd@arndb.de>, Sam Ravnborg <sam@ravnborg.org>,
	Karsten Keil <isdn@linux-pingi.de>
Subject: Re: [PATCH v2 1/3] Add the initify gcc plugin
Date: Tue, 12 Jul 2016 18:38:47 -0400	[thread overview]
Message-ID: <CAGXu5j+99nc9s-ci46s3r_CU5-6O6JeHERcW3mYRtnP71871rw@mail.gmail.com> (raw)
In-Reply-To: <20160712220853.GU1041@n2100.armlinux.org.uk>

On Tue, Jul 12, 2016 at 6:08 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Tue, Jul 12, 2016 at 03:45:56PM -0400, Kees Cook wrote:
>> On Mon, Jul 4, 2016 at 7:40 PM, Emese Revfy <re.emese@gmail.com> wrote:
>> > If a function is called by __init and __exit functions as well then
>> > the plugin moves it to the __exit section. This causes false positive
>> > section mismatch errors/warnings that I don't know how to handle yet.
>>
>> Should the mismatch checker be updated to recognize this case? Without
>> the plugin, I assume these kinds of functions would only ever be
>> marked for __exit? If so, should the plugin strip the __init marking
>> and only add __exit?
>
> That sounds like a problem for architectures that still discard the
> __exit section at link time to reduce the size of the linked kernel
> image - though, obviously, if using the plugin results in a smaller
> kernel image _with_ the exit sections, then there's a net benefit
> size-wise.

Ah right, __exit is dropped for non-modular builds. So, for "both
__init and __exit" it sounds like the behavior depends on the build:

- if modular: remove __init marking (since we need it after init)
- if non-modular: remove __exit marking (since we'll never call exit)

Is this something the build itself (rather than the plugin) could
notice and fix up? Hmmm

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Emese Revfy <re.emese@gmail.com>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	PaX Team <pageexec@freemail.hu>,
	Brad Spengler <spender@grsecurity.net>,
	Michal Marek <mmarek@suse.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	minipli@ld-linux.so, Catalin Marinas <catalin.marinas@arm.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	David Brown <david.brown@linaro.org>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jeff Layton <jlayton@poochiereds.net>,
	Arnd Bergmann <arnd@arndb.de>, Sam Ravnborg <sam@ravnborg.org>,
	Karsten Keil <isdn@linux-pingi.de>
Subject: [kernel-hardening] Re: [PATCH v2 1/3] Add the initify gcc plugin
Date: Tue, 12 Jul 2016 18:38:47 -0400	[thread overview]
Message-ID: <CAGXu5j+99nc9s-ci46s3r_CU5-6O6JeHERcW3mYRtnP71871rw@mail.gmail.com> (raw)
In-Reply-To: <20160712220853.GU1041@n2100.armlinux.org.uk>

On Tue, Jul 12, 2016 at 6:08 PM, Russell King - ARM Linux
<linux@armlinux.org.uk> wrote:
> On Tue, Jul 12, 2016 at 03:45:56PM -0400, Kees Cook wrote:
>> On Mon, Jul 4, 2016 at 7:40 PM, Emese Revfy <re.emese@gmail.com> wrote:
>> > If a function is called by __init and __exit functions as well then
>> > the plugin moves it to the __exit section. This causes false positive
>> > section mismatch errors/warnings that I don't know how to handle yet.
>>
>> Should the mismatch checker be updated to recognize this case? Without
>> the plugin, I assume these kinds of functions would only ever be
>> marked for __exit? If so, should the plugin strip the __init marking
>> and only add __exit?
>
> That sounds like a problem for architectures that still discard the
> __exit section at link time to reduce the size of the linked kernel
> image - though, obviously, if using the plugin results in a smaller
> kernel image _with_ the exit sections, then there's a net benefit
> size-wise.

Ah right, __exit is dropped for non-modular builds. So, for "both
__init and __exit" it sounds like the behavior depends on the build:

- if modular: remove __init marking (since we need it after init)
- if non-modular: remove __exit marking (since we'll never call exit)

Is this something the build itself (rather than the plugin) could
notice and fix up? Hmmm

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

  reply	other threads:[~2016-07-12 22:39 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04 23:39 [PATCH v2 0/3] Introduce the initify gcc plugin Emese Revfy
2016-07-04 23:39 ` [kernel-hardening] " Emese Revfy
2016-07-04 23:40 ` [PATCH v2 1/3] Add " Emese Revfy
2016-07-04 23:40   ` [kernel-hardening] " Emese Revfy
2016-07-12 19:45   ` Kees Cook
2016-07-12 19:45     ` [kernel-hardening] " Kees Cook
2016-07-12 19:45     ` Kees Cook
2016-07-12 20:07     ` Emese Revfy
2016-07-12 20:07       ` [kernel-hardening] " Emese Revfy
2016-07-12 20:07       ` Emese Revfy
2016-07-12 20:05       ` Kees Cook
2016-07-12 20:05         ` [kernel-hardening] " Kees Cook
2016-07-12 20:05         ` Kees Cook
2016-07-13 20:34         ` Emese Revfy
2016-07-13 20:34           ` [kernel-hardening] " Emese Revfy
2016-07-13 20:34           ` Emese Revfy
2016-07-12 22:08     ` Russell King - ARM Linux
2016-07-12 22:08       ` [kernel-hardening] " Russell King - ARM Linux
2016-07-12 22:08       ` Russell King - ARM Linux
2016-07-12 22:38       ` Kees Cook [this message]
2016-07-12 22:38         ` [kernel-hardening] " Kees Cook
2016-07-12 22:38         ` Kees Cook
2016-07-13 21:26         ` Emese Revfy
2016-07-13 21:26           ` [kernel-hardening] " Emese Revfy
2016-07-13 21:26           ` Emese Revfy
2016-07-13 20:48     ` Emese Revfy
2016-07-13 20:48       ` [kernel-hardening] " Emese Revfy
2016-07-13 20:48       ` Emese Revfy
2016-07-13 21:04       ` Kees Cook
2016-07-13 21:04         ` [kernel-hardening] " Kees Cook
2016-07-13 21:04         ` Kees Cook
2016-07-04 23:42 ` [PATCH v2 2/3] Mark functions with the __nocapture attribute Emese Revfy
2016-07-04 23:42   ` [kernel-hardening] " Emese Revfy
2016-07-12 19:08   ` Kees Cook
2016-07-12 19:08     ` [kernel-hardening] " Kees Cook
2016-07-12 19:08     ` Kees Cook
2016-07-12 19:23     ` [kernel-hardening] " Daniel Micay
2016-07-12 19:47       ` Kees Cook
2016-07-12 19:47         ` Kees Cook
2016-07-04 23:43 ` [PATCH v2 3/3] Constify some function parameters Emese Revfy
2016-07-04 23:43   ` [kernel-hardening] " Emese Revfy
2016-07-04 23:58   ` kbuild test robot
2016-07-04 23:58     ` [kernel-hardening] " kbuild test robot
2016-07-06 16:45     ` Emese Revfy
2016-07-06 16:45       ` [kernel-hardening] " Emese Revfy
2016-07-06 16:44   ` Emese Revfy
2016-07-06 16:44     ` [kernel-hardening] " Emese Revfy

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=CAGXu5j+99nc9s-ci46s3r_CU5-6O6JeHERcW3mYRtnP71871rw@mail.gmail.com \
    --to=keescook@chromium.org \
    --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=isdn@linux-pingi.de \
    --cc=jlayton@poochiereds.net \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=minipli@ld-linux.so \
    --cc=mmarek@suse.com \
    --cc=pageexec@freemail.hu \
    --cc=re.emese@gmail.com \
    --cc=sam@ravnborg.org \
    --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.