[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5j+t_RBhQ0hLWQEi3Y55vBq5QibO_ar0zykjG7nLPOObmg@mail.gmail.com>
Date: Wed, 13 Jul 2016 14:04:23 -0700
From: Kees Cook <keescook@...omium.org>
To: Emese Revfy <re.emese@...il.com>
Cc: "kernel-hardening@...ts.openwall.com"
<kernel-hardening@...ts.openwall.com>,
PaX Team <pageexec@...email.hu>,
Brad Spengler <spender@...ecurity.net>,
Michal Marek <mmarek@...e.com>,
LKML <linux-kernel@...r.kernel.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
linux-kbuild <linux-kbuild@...r.kernel.org>, minipli@...linux.so,
Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
David Brown <david.brown@...aro.org>,
"benh@...nel.crashing.org" <benh@...nel.crashing.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Jeff Layton <jlayton@...chiereds.net>,
Arnd Bergmann <arnd@...db.de>, Sam Ravnborg <sam@...nborg.org>,
Karsten Keil <isdn@...ux-pingi.de>
Subject: Re: [PATCH v2 1/3] Add the initify gcc plugin
On Wed, Jul 13, 2016 at 1:48 PM, Emese Revfy <re.emese@...il.com> wrote:
> On Tue, 12 Jul 2016 15:45:56 -0400
> Kees Cook <keescook@...omium.org> wrote:
>
>> On Mon, Jul 4, 2016 at 7:40 PM, Emese Revfy <re.emese@...il.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?
>
> I don't modify the existing attributes. I just add a new __init/__exit when
> a function hasn't a section attribute yet.
> There are three cases:
> * when the function is called only by __init functions then the plugin adds
> the __init attribute
> * when the function is called only by __exit functions then the plugin adds
> the __exit attribute
> * when the function is called by __init and __exit functions too then the
> plugin adds the __exit attribute.
> The last case causes the false positive(?) message of the section mismatch.
In the latter case, how does the linker actually choose where to put
such a function?
For a modular build, if it puts it in .init, it will be missing during
exit. If it puts it in .exit, that seems correct.
For a non-modular build, if it puts it in .init, this is correct. If
it puts it in .exit, it may be missing for init because the exit
section may have already been removed at final link time.
-Kees
--
Kees Cook
Chrome OS & Brillo Security
Powered by blists - more mailing lists