[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNATamQYGDj0CQCn6Fg-+tNykfGqFzhjFxUyoGYxn2DSKgA@mail.gmail.com>
Date: Fri, 27 Sep 2019 18:56:55 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Jessica Yu <jeyu@...nel.org>
Cc: Matthias Maennich <maennich@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Joel Fernandes <joel@...lfernandes.org>,
Martijn Coenen <maco@...roid.com>,
Will Deacon <will.deacon@....com>,
Michal Marek <michal.lkml@...kovi.net>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/7] modpost: fix broken sym->namespace for external
module builds
On Fri, Sep 27, 2019 at 6:37 PM Masahiro Yamada
<yamada.masahiro@...ionext.com> wrote:
>
> Currently, external module builds produce tons of false-positives:
>
> WARNING: module <mod> uses symbol <sym> from namespace <ns>, but does not import it.
>
> Here, the <ns> part shows a random string.
>
> When you build external modules, the symbol info of vmlinux and
> in-kernel modules are read from $(objtree)/Module.symvers, but
> read_dump() is buggy in multiple ways:
>
> [1] When the modpost is run for vmlinux and in-kernel modules,
> sym_extract_namespace() correctly allocates memory for the namespace.
> On the other hand, read_dump() does not, then sym->namespace will
> point to somewhere in the line buffer of get_next_line(). The data
> in the buffer will be replaced soon, and sym->namespace will end up
> with pointing to unrelated data. As a result, check_exports() will
> show random strings in the warning messages.
>
> [2] When there is no namespace, sym_extract_namespace() returns NULL.
> On the other hand, read_dump() sets namespace to an empty string "".
> (but, it will be later replaced with unrelated data due to bug [1].)
> The check_exports() shows a warning unless exp->namespace is NULL,
> so every symbol read from read_dump() emits the warning, which is
> mostly false positive.
>
> To address [1], I added NOFAIL(strdup(...)) to allocate memory.
> For [2], I changed the if-conditional in check_exports().
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
> ---
>
Fixes: cb9b55d21fe0 ("modpost: add support for symbol namespaces")
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists