Re: Module loading problem since 5.3

From: Matthias Maennich
Date: Wed Oct 16 2019 - 09:37:16 EST

On Wed, Oct 16, 2019 at 12:50:30PM +0000, Luis Chamberlain wrote:
On Mon, Oct 14, 2019 at 03:44:40PM +0100, Matthias Maennich wrote:
Hi Luis!

On Mon, Oct 14, 2019 at 08:52:35AM +0000, Luis Chamberlain wrote:
> On Fri, Oct 11, 2019 at 09:26:05PM +0200, Heiner Kallweit wrote:
> > On 10.10.2019 19:15, Luis Chamberlain wrote:
> > >
> > >
> > > On Thu, Oct 10, 2019, 6:50 PM Heiner Kallweit <hkallweit1@xxxxxxxxx <mailto:hkallweit1@xxxxxxxxx>> wrote:
> > >
> > > Â ÂMODULE_SOFTDEP("pre: realtek")
> > >
> > > Are you aware of any current issues with module loading
> > > that could cause this problem?
> > >
> > >
> > > Nope. But then again I was not aware of MODULE_SOFTDEP(). I'd encourage an extension to lib/kmod.c or something similar which stress tests this. One way that comes to mind to test this is to allow a new tests case which loads two drives which co depend on each other using this macro. That'll surely blow things up fast. That is, the current kmod tests uses request_module() or get_fs_type(), you'd want a new test case with this added using then two new dummy test drivers with the macro dependency.
> > >
> > > If you want to resolve this using a more tested path, you could have request_module() be used as that is currently tested. Perhaps a test patch for that can rule out if it's the macro magic which is the issue.
> > >
> > > Â Luis
> >
> > Maybe issue is related to a bug in introduction of symbol namespaces, see here:
> >
> Can you have your user with issues either revert 8651ec01daed or apply the fixes
> mentioned by Matthias to see if that was the issue?
> Matthias what module did you run into which let you run into the issue
> with depmod? I ask as I think it would be wise for us to add a test case
> using lib/test_kmod.c and tools/testing/selftests/kmod/ for the
> regression you detected.

The depmod warning can be reproduced when using a symbol that is built
into vmlinux and used from a module. E.g. with CONFIG_USB_STORAGE=y and
CONFIG_USB_UAS=m, the symbol `usb_stor_adjust_quirks` is built in with
namespace USB_STORAGE and depmod stumbles upon this emitting the
following warning (e.g. during make modules_install).

depmod: WARNING: [...]/uas.ko needs unknown symbol usb_stor_adjust_quirks

As there is another (less intrusive) way of implementing the namespace
feature, I posted a patch series [1] on last Thursday that should
mitigate the issue as the ksymtab entries depmod eventually relies on
are no longer carrying the namespace in their names.



Yes but kmalloc() is built-in, and used by *all* drivers compiled as
modules, so why was that an issue?

I believe you meant, "why was that *not* an issue?".
In ksymtab, namespaced symbols had the format


while symbols without namespace would still use the old format


These are also the names that are extracted into (using
scripts/mksysmap). Depmod is reading the and for symbols used
by modules that are in a namespace, it would not find a match as it does
not understand the namespace notation. Depmod would still not emit a
warning for symbols without namespace as their format did not change.