[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNASpJFAgvuak=mz5kkM3oGh9-M8y_84KZv-xcUkQ0h=d_A@mail.gmail.com>
Date: Wed, 15 May 2019 17:57:50 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Sam Ravnborg <sam@...nborg.org>, Jessica Yu <jeyu@...nel.org>,
Lucas De Marchi <lucas.de.marchi@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Kees Cook <keescook@...omium.org>,
Michal Marek <michal.lkml@...kovi.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] kbuild: check uniqueness of basename of modules
On Wed, May 15, 2019 at 5:14 PM Greg KH <gregkh@...uxfoundation.org> wrote:
>
> On Wed, May 15, 2019 at 10:08:12AM +0200, Arnd Bergmann wrote:
> > On Wed, May 15, 2019 at 9:39 AM Masahiro Yamada
> > <yamada.masahiro@...ionext.com> wrote:
> > >
> > > In the recent build test of linux-next, Stephen saw a build error
> > > caused by a broken .tmp_versions/*.mod file:
> > >
> > > https://lkml.org/lkml/2019/5/13/991
> > >
> > > drivers/net/phy/asix.ko and drivers/net/usb/asix.ko have the same
> > > basename, and there is a race in generating .tmp_versions/asix.mod
> > >
> > > Kbuild has not checked this before, and it occasionally shows up with
> > > obscure error message when this kind of race occurs.
> > >
> > > It is not trivial to catch this potential issue by eyes.
> > >
> > > Hence, this script.
> > >
> > > I compile-tested allmodconfig for the latest kernel as of writing,
> > > it detected the following:
> > >
> > > warning: same basename '88pm800.ko' if the following are built as modules:
> > > drivers/regulator/88pm800.ko
> > > drivers/mfd/88pm800.ko
> > > warning: same basename 'adv7511.ko' if the following are built as modules:
> > > drivers/gpu/drm/bridge/adv7511/adv7511.ko
> > > drivers/media/i2c/adv7511.ko
> > > warning: same basename 'asix.ko' if the following are built as modules:
> > > drivers/net/phy/asix.ko
> > > drivers/net/usb/asix.ko
> > > warning: same basename 'coda.ko' if the following are built as modules:
> > > fs/coda/coda.ko
> > > drivers/media/platform/coda/coda.ko
> > > warning: same basename 'realtek.ko' if the following are built as modules:
> > > drivers/net/phy/realtek.ko
> > > drivers/net/dsa/realtek.ko
> > >
> > > Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
> > > Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
> >
> > That looks great!
> >
> > > ---
> > >
> > > [Alternative fix ? ]
> > >
> > > I do not know about the user experience of modprobe etc.
> > > when two different modules have the same name.
> > > It does not matter if this is correctly handled by modules.order?
> > >
> > > If this is just a problem of the build system, it is pretty easy to fix.
> > > For example, if we prepend the directory path, parallel build will
> > > never write to the same file simultanously.
> > >
> > > asix.mod -> drivers/net/phy/asix.mod
> > > asix.mod -> drivers/net/usb/asix.mod
> >
> > non-unique module names cause all kinds of problems, and
> > modprobe can certainly not handle them correctly, and there
> > are issues with symbols exported from a module when another
> > one has the same name.
>
> /sys/modules/ will fall over when this happens as well. I thought we
> had the "rule" that module names had to be unique, I guess it was only a
> matter of time before they started colliding :(
>
> So warning is good, but forbidding this is better, as things will break.
>
> Or we need to fix up the places where things will break.
If we intentionally break the build,
we need to send fix-up patches to subsystems first.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists