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: <CAK7LNASMOqfjHsE82ErjeYOJjxHgD_HZcm1VUcESORS6UridWw@mail.gmail.com>
Date:   Sat, 21 May 2022 13:14:53 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Randy Dunlap <rdunlap@...radead.org>
Cc:     Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        Liam Beguin <liambeguin@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        linux-iio@...r.kernel.org, Peter Rosin <peda@...ntia.se>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>,
        KUnit Development <kunit-dev@...glegroups.com>
Subject: Re: kbuild problem: ERROR: modpost: missing MODULE_LICENSE() in drivers/iio/afe/iio-rescale.o

On Sat, May 21, 2022 at 12:51 PM Randy Dunlap <rdunlap@...radead.org> wrote:
>
> Ok, one more.
> [also adding Liam here]
>
> On 5/20/22 20:17, Randy Dunlap wrote:
> >
> >
> > On 5/20/22 20:08, Randy Dunlap wrote:
> >>
> >>
> >> On 5/20/22 19:40, Randy Dunlap wrote:
> >>> Hi,
> >>>
> >>> In March I reported that a randconfig build complained:
> >>>
> >>> ERROR: modpost: missing MODULE_LICENSE() in drivers/iio/afe/iio-rescale.o
> >>>
> >>> (https://lore.kernel.org/all/16509fb6-e40c-e31b-2c80-264c44b0beb9@infradead.org/)
> >>>
> >>> I am still seeing this problem so I tried to dig into it a bit.
> >>> However, I don't see why get_next_modinfo() and friends don't find the
> >>> MODULE_LICENSE() since it is in the iio-rescale.o file.
> >>>
> >>> (BTW, I see this build error on many different $ARCH [around 15 tested]
> >>> and with 2 different versions of GCC.)
> >>>
> >>> Q1: Is modpost checking both vmlinux and iio-rescale.o for modinfo license
> >>> strings?
> >>>
> >>> It looks like it is, because it appears (?) that modpost is looking at
> >>> drivers/iio/test/iio-test-rescale.o (<<<<< a kunit test, which is builtin
> >>> in my .config) and at drivers/iio/afe/iio-rescale.o (which is built as a
> >>> loadable module).
> >>>
> >>> Is this confusing modpost?
> >>> I renamed drivers/iio/afe/iio-rescale.c to afe-rescale.c and changed its
> >>> Makefile entry accordingly and the MODULE_LICENSE error goes away.
> >>
> >> Oh well. This rename causes drivers/iio/test/iio-test-rescale.c to have
> >> build errors, so that's not a solution, just some info...
> >
> > and that was due to not updating drivers/iio/test/Makefile.
> > When that is done, the missing MODULE_LICENSE() is back in afe-rescale.o.
> >
> >>
> >>> Is this a modpost error or is kunit messing things up?
> >>>
> >>> thanks for looking.
>
> Does this look OK? It allows afe/iio-rescale.o to build XOR
> test/iio-rescale.o (not both of them).
>
> --- a/drivers/iio/test/Kconfig
> +++ b/drivers/iio/test/Kconfig
> @@ -6,7 +6,7 @@
>  # Keep in alphabetical order
>  config IIO_RESCALE_KUNIT_TEST
>         bool "Test IIO rescale conversion functions"
> -       depends on KUNIT=y && !IIO_RESCALE
> +       depends on KUNIT=y && IIO_RESCALE=n
>         default KUNIT_ALL_TESTS
>         help
>           If you want to run tests on the iio-rescale code say Y here.
>
>
> --
> ~Randy



As you may have already noticed,
the root cause is drivers/iio/test/Makefile

obj-$(CONFIG_IIO_RESCALE_KUNIT_TEST) += iio-test-rescale.o ../afe/iio-rescale.o



For the combination of
CONFIG_IIO_RESCALE=m
CONFIG_IIO_RESCALE_KUNIT_TEST=y,

drivers/iio/afe/iio-rescale.o is built twice;
as modular by drivers/iio/afe/Makefile, and
as built-in by drivers/iio/test/Makefile.

That's why MODULE_LICENSE() is lost.


I think your solution will work
although this Makefile is not recommended.






--
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ