lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2Ag60Dw1mbTsj7XVanT6u8kQW5vqK3hAD-yon1G8qKXw@mail.gmail.com>
Date:   Mon, 6 Dec 2021 20:47:09 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Sven Peter <sven@...npeter.dev>
Cc:     kernel test robot <lkp@...el.com>,
        Linux I2C <linux-i2c@...r.kernel.org>, kbuild-all@...ts.01.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Wolfram Sang <wsa-dev@...g-engineering.com>,
        Arnd Bergmann <arnd@...db.de>,
        Hector Martin <marcan@...can.st>,
        Alyssa Rosenzweig <alyssa@...enzweig.io>
Subject: Re: powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:undefined
 reference to `__this_module'

On Mon, Dec 6, 2021 at 6:02 PM Sven Peter <sven@...npeter.dev> wrote:
> On Mon, Dec 6, 2021, at 11:10, kernel test robot wrote:

> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@...el.com>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> >>> powerpc64-linux-ld: warning: orphan section `.stubs' from `drivers/i2c/busses/i2c-pasemi-core.o' being placed in section `.stubs'
> >>> powerpc64-linux-ld: drivers/i2c/busses/i2c-pasemi-core.o:(.toc+0x0): undefined reference to `__this_module'
>
> This seems to be triggered by compiling one of {pci,platform} as a module and the
> other one as built-in. That setup can only happen with COMPILE_TEST since -pci
> is otherwise only compiled for powerpc and -platform for arm64.
>
> -core.c is only built once with THIS_MODULE expanding to __this_module. That will
> fail when linking the built-in driver where THIS_MODULE should've been NULL instead.
>
> The most simple fix (that also has no chance of breaking anything) is probably to
> just move
>
>   smbus->adapter.owner = THIS_MODULE;
>
> from core to both apple.c and pci.c. I'll prepare a patch later this week.

I'd prefer fixing this in a better way, linking an object file into
both vmlinux and a loadable
module is not supported at all. Other options are:

- #include the common .c file from the individual drivers (not great)
- use Kconfig logic to prevent the broken configuration
- use Makefile tricks to make both drivers built-in when this happens
- make the common part a separate loadable module, exporting all the
  global symbols.

Out of these, I would prefer the last option.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ