Re: [kernel-hardening] Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Joe Perches
On Tue, 2016-06-28 at 18:07 -0400, valdis.kletni...@vt.edu wrote: > On Tue, 28 Jun 2016 14:49:15 -0700, Joe Perches said: > > > > > Another potentially useful plugin, especially for embedded systems, > > would be to compress any string literal marked with > > > >  __attribute__((format(print

Re: [kernel-hardening] Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Valdis . Kletnieks
On Tue, 28 Jun 2016 14:49:15 -0700, Joe Perches said: > Another potentially useful plugin, especially for embedded systems, > would be to compress any string literal marked with > >  __attribute__((format(printf, string-index,))) > > and decompress the compressed format on the stack in lib/v

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Joe Perches
On Tue, 2016-06-28 at 13:34 +0200, Emese Revfy wrote: > I would like to introduce the initify gcc plugin. The kernel already has > a mechanism to free up code and data memory that is only used during kernel > or module initialization. > This plugin will teach the compiler to find more such code and

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Emese Revfy
On Tue, 28 Jun 2016 21:02:54 +0200 Rasmus Villemoes wrote: > 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 Note that I didn't

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Emese Revfy
On Tue, 28 Jun 2016 19:00:22 +0200 Mathias Krause wrote: > > section vanilla vanilla + initifychange > > --- > > .rodata 39059688 (0x25400e8)38527210 (0x24be0ea)-532478 > > .data

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Rasmus Villemoes
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",

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Joe Perches
On Tue, 2016-06-28 at 09:35 -0700, Joe Perches wrote: > (adding Mathias Krause who did something similar via macros in 2014) > > https://lkml.org/lkml/2014/6/22/149 > > On Tue, 2016-06-28 at 13:34 +0200, Emese Revfy wrote: > > > > I would like to introduce the initify gcc plugin. The kernel alre

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Mathias Krause
Hi Emese, On Tue, Jun 28, 2016 at 01:34:07PM +0200, Emese Revfy wrote: > I would like to introduce the initify gcc plugin. The kernel already has > a mechanism to free up code and data memory that is only used during kernel > or module initialization. > This plugin will teach the compiler to find

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Joe Perches
(adding Mathias Krause who did something similar via macros in 2014) https://lkml.org/lkml/2014/6/22/149 On Tue, 2016-06-28 at 13:34 +0200, Emese Revfy wrote: > I would like to introduce the initify gcc plugin. The kernel already has > a mechanism to free up code and data memory that is only used

Re: [PATCH v1 0/2] Introduce the initify gcc plugin

2016-06-28 Thread Emese Revfy
On Tue, 28 Jun 2016 13:34:07 +0200 Emese Revfy wrote: > * automatically discover init/exit functions and apply the __init or >__exit attributes on them Hi, I have a question about this. If a function is called by __init and __exit functions as well then I move it to the __exit section. I