On Thu, Sep 26, 2019 at 05:24:46PM -0500, Shaun Ruffell wrote:
> When building an out-of-tree module I was receiving many warnings from
> modpost like:
> 
>   WARNING: module dahdi_vpmadt032_loader uses symbol __kmalloc from namespace 
> ts/dahdi-linux/drivers/dahdi/dahdi-version.o: ..., but does not import it.
>   WARNING: module dahdi_vpmadt032_loader uses symbol vpmadtreg_register from 
> namespace linux/drivers/dahdi/dahdi-version.o: ..., but does not import it.
>   WARNING: module dahdi_vpmadt032_loader uses symbol param_ops_int from 
> namespace ahdi-linux/drivers/dahdi/dahdi-version.o: ..., but does not import 
> it.
>   WARNING: module dahdi_vpmadt032_loader uses symbol __init_waitqueue_head 
> from namespace ux/drivers/dahdi/dahdi-version.o: ..., but does not import it.
>   ...
> 
> The fundamental issue appears to be that read_dump() is passing a
> pointer to a statically allocated buffer for the namespace which is
> reused as the file is parsed.
> 
> This change makes it so that 'struct symbol' holds a copy of the
> namespace string in the same way that it holds a copy of the symbol
> string. Because a copy is being made, handle_modversion can now free the
> temporary copy
> 
> Fixes: cb9b55d21fe0 ("modpost: add support for symbol namespaces")
> Cc: Martijn Coenen <m...@android.com>
> Cc: Joel Fernandes (Google) <j...@joelfernandes.org>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Matthias Maennich <maenn...@google.com>
> Cc: Jessica Yu <j...@kernel.org>
> Signed-off-by: Shaun Ruffell <sruff...@sruffell.net>
> ---
> 
> Hi,
> 
> I didn't test that this change works with the namespaces, or investigate why
> read_dump() is only called first while building out-of-tree modules, but it 
> does
> seem correct to me for the symbol to own the memory backing the namespace
> string.
> 
> I also realize I'm jumping the gun a bit by testing against master before
> 5.4-rc1 is tagged.

Yes!!!

This fixes the issue that I reported to Mattias a few days ago on irc.
I am hitting this by just trying to build a single directory work of
modules:
        make M=drivers/usb/

I just tested this patch and it works for me, thanks so much!

Tested-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

Reply via email to