Re: [PATCH v2 1/3] Add the initify gcc plugin
From: Emese Revfy
Date: Wed Jul 13 2016 - 17:20:14 EST
On Tue, 12 Jul 2016 18:38:47 -0400
Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> On Tue, Jul 12, 2016 at 6:08 PM, Russell King - ARM Linux
> <linux@xxxxxxxxxxxxxxx> 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@xxxxxxxxx> wrote:
> > 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)
When gcc compiles vmlinux these functions should be in __init and when
it compiles *.ko then they can be in __exit. I have no time to do this
now but I added it to my todo list.
The temporary fix can be that I enable this section move only on x86
(on other archs it will decrase the coverage).
--
Emese