LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* wish: build time warning for missing MODULE_LICENSE
@ 2008-03-30 18:01 Adrian Bunk
  2008-03-30 19:04 ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2008-03-30 18:01 UTC (permalink / raw)
  To: rusty, sam; +Cc: linux-kbuild, linux-kernel

I just fixed a bug where I had accidentally removed a MODULE_LICENSE() 
from a file.

The problem is that such bugs are currently not discovered until someone 
actually runs a kernel with this module loaded.

Could we get a build time warning/error for a missing MODULE_LICENSE?

TIA
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wish: build time warning for missing MODULE_LICENSE
  2008-03-30 18:01 wish: build time warning for missing MODULE_LICENSE Adrian Bunk
@ 2008-03-30 19:04 ` Sam Ravnborg
  2008-03-30 20:34   ` Adrian Bunk
  0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2008-03-30 19:04 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: rusty, linux-kbuild, linux-kernel

On Sun, Mar 30, 2008 at 09:01:19PM +0300, Adrian Bunk wrote:
> I just fixed a bug where I had accidentally removed a MODULE_LICENSE() 
> from a file.
> 
> The problem is that such bugs are currently not discovered until someone 
> actually runs a kernel with this module loaded.
> 
> Could we get a build time warning/error for a missing MODULE_LICENSE?

Is it something as simple as this you are after?
[My dev box is dead atm so I have not done a kernel build
with this, only a single module].

	Sam

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 695b5d6..e8560a0 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1552,6 +1552,8 @@ static void read_symbols(char *modname)
 	}
 
 	license = get_modinfo(info.modinfo, info.modinfo_len, "license");
+	if (!license && !is_vmlinux(modname))
+		warn("modpost: missing MODULE_LICENSE() in %s\n", modname);
 	while (license) {
 		if (license_is_gpl_compatible(license))
 			mod->gpl_compatible = 1;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wish: build time warning for missing MODULE_LICENSE
  2008-03-30 19:04 ` Sam Ravnborg
@ 2008-03-30 20:34   ` Adrian Bunk
  2008-04-01  2:22     ` Dave Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2008-03-30 20:34 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: rusty, linux-kbuild, linux-kernel

On Sun, Mar 30, 2008 at 09:04:30PM +0200, Sam Ravnborg wrote:
> On Sun, Mar 30, 2008 at 09:01:19PM +0300, Adrian Bunk wrote:
> > I just fixed a bug where I had accidentally removed a MODULE_LICENSE() 
> > from a file.
> > 
> > The problem is that such bugs are currently not discovered until someone 
> > actually runs a kernel with this module loaded.
> > 
> > Could we get a build time warning/error for a missing MODULE_LICENSE?
> 
> Is it something as simple as this you are after?
> [My dev box is dead atm so I have not done a kernel build
> with this, only a single module].

Thanks, it seems to work - and I'm currently working on fixing the bugs 
it catches.

Considering that these are trivial to fix I'd even suggest a fatal() 
instead of the warn() for making them obvious for everyone doing build 
testing.

> 	Sam
> 
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 695b5d6..e8560a0 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1552,6 +1552,8 @@ static void read_symbols(char *modname)
>  	}
>  
>  	license = get_modinfo(info.modinfo, info.modinfo_len, "license");
> +	if (!license && !is_vmlinux(modname))
> +		warn("modpost: missing MODULE_LICENSE() in %s\n", modname);
>  	while (license) {
>  		if (license_is_gpl_compatible(license))
>  			mod->gpl_compatible = 1;

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wish: build time warning for missing MODULE_LICENSE
  2008-03-30 20:34   ` Adrian Bunk
@ 2008-04-01  2:22     ` Dave Jones
  2008-04-01  7:43       ` Adrian Bunk
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2008-04-01  2:22 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Sam Ravnborg, rusty, linux-kbuild, linux-kernel

On Sun, Mar 30, 2008 at 11:34:17PM +0300, Adrian Bunk wrote:
 > On Sun, Mar 30, 2008 at 09:04:30PM +0200, Sam Ravnborg wrote:
 > > On Sun, Mar 30, 2008 at 09:01:19PM +0300, Adrian Bunk wrote:
 > > > I just fixed a bug where I had accidentally removed a MODULE_LICENSE() 
 > > > from a file.
 > > > 
 > > > The problem is that such bugs are currently not discovered until someone 
 > > > actually runs a kernel with this module loaded.
 > > > 
 > > > Could we get a build time warning/error for a missing MODULE_LICENSE?
 > > 
 > > Is it something as simple as this you are after?
 > > [My dev box is dead atm so I have not done a kernel build
 > > with this, only a single module].
 > 
 > Thanks, it seems to work - and I'm currently working on fixing the bugs 
 > it catches.
 > 
 > Considering that these are trivial to fix I'd even suggest a fatal() 
 > instead of the warn() for making them obvious for everyone doing build 
 > testing.
 
In the Fedora kernel specfile, we have something to catch this at build time.
Relevant pieces are (munged a bit for clarity) ..

    find . -name "*.ko" -type f >modnames

    while read i
    do
      echo -n "$i " >> modinfo
      /sbin/modinfo -l $i >> modinfo
    done < modnames

    egrep -v \
          'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \
          modinfo && exit 1

This hasn't been triggering though, so either it stopped working at some point,
or we don't build the module you mention.  Which was it out of curiosity ?
Or was your slip-up an -mm only thing?

	Dave

-- 
http://www.codemonkey.org.uk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: wish: build time warning for missing MODULE_LICENSE
  2008-04-01  2:22     ` Dave Jones
@ 2008-04-01  7:43       ` Adrian Bunk
  0 siblings, 0 replies; 5+ messages in thread
From: Adrian Bunk @ 2008-04-01  7:43 UTC (permalink / raw)
  To: Dave Jones, Sam Ravnborg, rusty, linux-kbuild, linux-kernel

On Mon, Mar 31, 2008 at 10:22:48PM -0400, Dave Jones wrote:
> On Sun, Mar 30, 2008 at 11:34:17PM +0300, Adrian Bunk wrote:
>  > On Sun, Mar 30, 2008 at 09:04:30PM +0200, Sam Ravnborg wrote:
>  > > On Sun, Mar 30, 2008 at 09:01:19PM +0300, Adrian Bunk wrote:
>  > > > I just fixed a bug where I had accidentally removed a MODULE_LICENSE() 
>  > > > from a file.
>  > > > 
>  > > > The problem is that such bugs are currently not discovered until someone 
>  > > > actually runs a kernel with this module loaded.
>  > > > 
>  > > > Could we get a build time warning/error for a missing MODULE_LICENSE?
>  > > 
>  > > Is it something as simple as this you are after?
>  > > [My dev box is dead atm so I have not done a kernel build
>  > > with this, only a single module].
>  > 
>  > Thanks, it seems to work - and I'm currently working on fixing the bugs 
>  > it catches.
>  > 
>  > Considering that these are trivial to fix I'd even suggest a fatal() 
>  > instead of the warn() for making them obvious for everyone doing build 
>  > testing.
>  
> In the Fedora kernel specfile, we have something to catch this at build time.
> Relevant pieces are (munged a bit for clarity) ..
> 
>     find . -name "*.ko" -type f >modnames
> 
>     while read i
>     do
>       echo -n "$i " >> modinfo
>       /sbin/modinfo -l $i >> modinfo
>     done < modnames
> 
>     egrep -v \
>           'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \
>           modinfo && exit 1

I'd say the price for the most elegant solution goes to Sam.  ;)

> This hasn't been triggering though, so either it stopped working at some point,
> or we don't build the module you mention.  Which was it out of curiosity ?
> Or was your slip-up an -mm only thing?

My slip-up was the OSS ac97_codec in 2.6.25-rc.

The other ones I found until now are:
arch/x86/video/fbdev.c
drivers/ide/ide-pnp.c (bug introduced in 2.6.25-rc)
drivers/ide/pci/cmd640.c (bug introduced in 2.6.25-rc)
drivers/ide/ppc/mpc8xx.c (bug introduced in 2.6.25-rc)
drivers/ide/ppc/pmac.c (bug introduced in 2.6.25-rc)
drivers/ide/arm/ide_arm.c (bug introduced in 2.6.25-rc)
drivers/ide/cris/ide-cris.c (bug introduced in 2.6.25-rc)
drivers/ide/h8300/ide-h8300.c (bug introduced in 2.6.25-rc)
drivers/ide/legacy/gayle.c (bug introduced in 2.6.25-rc)
drivers/ide/legacy/buddha.c (bug introduced in 2.6.25-rc)
drivers/ide/legacy/falconide.c (bug introduced in 2.6.25-rc)
drivers/ide/legacy/macide.c (bug introduced in 2.6.25-rc)
drivers/ide/legacy/q40ide.c (bug introduced in 2.6.25-rc)
drivers/media/video/v4l2-int-device.c (bug introduced in 2.6.25-rc)
arch/arm/kernel/arthur.c

Most likely none of them is modular in the Fedora kernel and/or 
available on the architectures Fedora supports.

> 	Dave

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-04-01  7:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-30 18:01 wish: build time warning for missing MODULE_LICENSE Adrian Bunk
2008-03-30 19:04 ` Sam Ravnborg
2008-03-30 20:34   ` Adrian Bunk
2008-04-01  2:22     ` Dave Jones
2008-04-01  7:43       ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).