public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] module: Re-enable dynamic debugging for GPL-compatible OOT modules
@ 2011-10-28  3:38 Ben Hutchings
  2011-10-31  1:59 ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Hutchings @ 2011-10-28  3:38 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Nick Bowler, Greg KH, Dave Jones, Randy Dunlap, LKML,
	Debian kernel maintainers

Dynamic debugging was enabled for GPL-compatible out-of-tree modules
until my addition of TAINT_OOT_MODULE.  It should continue to be
enabled now.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/module.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index dab585e..448fd77 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2881,7 +2881,7 @@ static struct module *load_module(void __user *umod,
 	}
 
 	/* This has to be done once we're sure module name is unique. */
-	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
+	if (!(mod->taints & ~(1U << TAINT_CRAP | 1U << TAINT_OOT_MODULE)))
 		dynamic_debug_setup(info.debug, info.num_debug);
 
 	/* Find duplicate symbols */
@@ -2918,7 +2918,7 @@ static struct module *load_module(void __user *umod,
 	module_bug_cleanup(mod);
 
  ddebug:
-	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
+	if (!(mod->taints & ~(1U << TAINT_CRAP | 1U << TAINT_OOT_MODULE)))
 		dynamic_debug_remove(info.debug);
  unlock:
 	mutex_unlock(&module_mutex);
-- 
1.7.7



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

* Re: [PATCH 2/2] module: Re-enable dynamic debugging for GPL-compatible OOT modules
  2011-10-28  3:38 [PATCH 2/2] module: Re-enable dynamic debugging for GPL-compatible OOT modules Ben Hutchings
@ 2011-10-31  1:59 ` Rusty Russell
  2011-10-31 13:44   ` Ben Hutchings
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2011-10-31  1:59 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Nick Bowler, Greg KH, Dave Jones, Randy Dunlap, LKML,
	Debian kernel maintainers, Mathieu Desnoyers

On Fri, 28 Oct 2011 04:38:14 +0100, Ben Hutchings <ben@decadent.org.uk> wrote:
> Dynamic debugging was enabled for GPL-compatible out-of-tree modules
> until my addition of TAINT_OOT_MODULE.  It should continue to be
> enabled now.

Please just remove the test entirely.

AFAICT there's nothing unique to dynamic debug which means it should
avoid taint.  If it oopses, we'll learn all about tainting in the oops
message.

> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>  kernel/module.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/module.c b/kernel/module.c
> index dab585e..448fd77 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -2881,7 +2881,7 @@ static struct module *load_module(void __user *umod,
>  	}
>  
>  	/* This has to be done once we're sure module name is unique. */
> -	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
> +	if (!(mod->taints & ~(1U << TAINT_CRAP | 1U << TAINT_OOT_MODULE)))
>  		dynamic_debug_setup(info.debug, info.num_debug);
>  
>  	/* Find duplicate symbols */
> @@ -2918,7 +2918,7 @@ static struct module *load_module(void __user *umod,
>  	module_bug_cleanup(mod);
>  
>   ddebug:
> -	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
> +	if (!(mod->taints & ~(1U << TAINT_CRAP | 1U << TAINT_OOT_MODULE)))
>  		dynamic_debug_remove(info.debug);
>   unlock:
>  	mutex_unlock(&module_mutex);
> -- 
> 1.7.7
> 
> 

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

* Re: [PATCH 2/2] module: Re-enable dynamic debugging for GPL-compatible OOT modules
  2011-10-31  1:59 ` Rusty Russell
@ 2011-10-31 13:44   ` Ben Hutchings
  2011-11-01  2:09     ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Hutchings @ 2011-10-31 13:44 UTC (permalink / raw)
  To: Rusty Russell, Jason Baron
  Cc: Nick Bowler, Greg KH, Dave Jones, Randy Dunlap, LKML,
	Debian kernel maintainers, Mathieu Desnoyers

[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]

On Mon, 2011-10-31 at 12:29 +1030, Rusty Russell wrote:
> On Fri, 28 Oct 2011 04:38:14 +0100, Ben Hutchings <ben@decadent.org.uk> wrote:
> > Dynamic debugging was enabled for GPL-compatible out-of-tree modules
> > until my addition of TAINT_OOT_MODULE.  It should continue to be
> > enabled now.
> 
> Please just remove the test entirely.
> 
> AFAICT there's nothing unique to dynamic debug which means it should
> avoid taint.  If it oopses, we'll learn all about tainting in the oops
> message.

It looks like the dynamic debug facility is not meant to be available to
proprietary modules.

Ben.

> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> > ---
> >  kernel/module.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/kernel/module.c b/kernel/module.c
> > index dab585e..448fd77 100644
> > --- a/kernel/module.c
> > +++ b/kernel/module.c
> > @@ -2881,7 +2881,7 @@ static struct module *load_module(void __user *umod,
> >  	}
> >  
> >  	/* This has to be done once we're sure module name is unique. */
> > -	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
> > +	if (!(mod->taints & ~(1U << TAINT_CRAP | 1U << TAINT_OOT_MODULE)))
> >  		dynamic_debug_setup(info.debug, info.num_debug);
> >  
> >  	/* Find duplicate symbols */
> > @@ -2918,7 +2918,7 @@ static struct module *load_module(void __user *umod,
> >  	module_bug_cleanup(mod);
> >  
> >   ddebug:
> > -	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
> > +	if (!(mod->taints & ~(1U << TAINT_CRAP | 1U << TAINT_OOT_MODULE)))
> >  		dynamic_debug_remove(info.debug);
> >   unlock:
> >  	mutex_unlock(&module_mutex);
> > -- 
> > 1.7.7
> > 
> > 
> 

-- 
Ben Hutchings
Computers are not intelligent.	They only think they are.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: [PATCH 2/2] module: Re-enable dynamic debugging for GPL-compatible OOT modules
  2011-10-31 13:44   ` Ben Hutchings
@ 2011-11-01  2:09     ` Rusty Russell
  2011-11-01  3:59       ` [PATCH] module: Enable dynamic debugging regardless of taint Ben Hutchings
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2011-11-01  2:09 UTC (permalink / raw)
  To: Ben Hutchings, Jason Baron
  Cc: Nick Bowler, Greg KH, Dave Jones, Randy Dunlap, LKML,
	Debian kernel maintainers, Mathieu Desnoyers

On Mon, 31 Oct 2011 13:44:17 +0000, Ben Hutchings <ben@decadent.org.uk> wrote:
Non-text part: multipart/signed
> On Mon, 2011-10-31 at 12:29 +1030, Rusty Russell wrote:
> > On Fri, 28 Oct 2011 04:38:14 +0100, Ben Hutchings <ben@decadent.org.uk> wrote:
> > > Dynamic debugging was enabled for GPL-compatible out-of-tree modules
> > > until my addition of TAINT_OOT_MODULE.  It should continue to be
> > > enabled now.
> > 
> > Please just remove the test entirely.
> > 
> > AFAICT there's nothing unique to dynamic debug which means it should
> > avoid taint.  If it oopses, we'll learn all about tainting in the oops
> > message.
> 
> It looks like the dynamic debug facility is not meant to be available to
> proprietary modules.

That was my guess too, but Mathieu (the author) said it was about
malformed modules:

On Wed, 26 Oct 2011 02:15:21 -0400:
> This check for tainted modules was first introduced with markers, and
> then used by tracepoints, and then also by dynamic debug. The rationale
> for this check was mainly to ensure that the marker/tracepoint code
> would not trigger a crash when loading a module with incompatible module
> header, originally compiled for an older kernel, into a newer kernel.
> This problem would happen even if the said module does not contain any
> marker/tracepoint, because we happen to try to use fields that are
> non-existent in the module header.

This is pretty bogus: since they forced the module in the first place,
they can handle the explosion.

So we should drop it altogether.

Thanks,
Rusty.

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

* [PATCH] module: Enable dynamic debugging regardless of taint
  2011-11-01  2:09     ` Rusty Russell
@ 2011-11-01  3:59       ` Ben Hutchings
  2011-11-01  4:41         ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Hutchings @ 2011-11-01  3:59 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Jason Baron, Nick Bowler, Greg KH, Dave Jones, Randy Dunlap, LKML,
	Debian kernel maintainers, Mathieu Desnoyers

Dynamic debugging is currently disabled for tainted modules, except
for TAINT_CRAP.  This prevents use of dynamic debugging for
out-of-tree modules now that they are also tainted.

This condition was apparently intended to avoid a crash if a force-
loaded module has an incompatible definition of dynamic debug
structures.  However, a administrator that forces us to load a module
is claiming that it *is* compatible even though it fails our version
checks.  If they are mistaken, there are any number of ways the module
could crash the system.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/module.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index dab585e..ef8cb70 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2881,8 +2881,7 @@ static struct module *load_module(void __user *umod,
 	}
 
 	/* This has to be done once we're sure module name is unique. */
-	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
-		dynamic_debug_setup(info.debug, info.num_debug);
+	dynamic_debug_setup(info.debug, info.num_debug);
 
 	/* Find duplicate symbols */
 	err = verify_export_symbols(mod);
@@ -2918,8 +2917,7 @@ static struct module *load_module(void __user *umod,
 	module_bug_cleanup(mod);
 
  ddebug:
-	if (!mod->taints || mod->taints == (1U<<TAINT_CRAP))
-		dynamic_debug_remove(info.debug);
+	dynamic_debug_remove(info.debug);
  unlock:
 	mutex_unlock(&module_mutex);
 	synchronize_sched();
-- 
1.7.7


-- 
Ben Hutchings
Computers are not intelligent.	They only think they are.

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

* Re: [PATCH] module: Enable dynamic debugging regardless of taint
  2011-11-01  3:59       ` [PATCH] module: Enable dynamic debugging regardless of taint Ben Hutchings
@ 2011-11-01  4:41         ` Rusty Russell
  2011-11-01 12:48           ` Mathieu Desnoyers
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2011-11-01  4:41 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Jason Baron, Nick Bowler, Greg KH, Dave Jones, Randy Dunlap, LKML,
	Debian kernel maintainers, Mathieu Desnoyers

On Tue, 01 Nov 2011 03:59:33 +0000, Ben Hutchings <ben@decadent.org.uk> wrote:
> Dynamic debugging is currently disabled for tainted modules, except
> for TAINT_CRAP.  This prevents use of dynamic debugging for
> out-of-tree modules now that they are also tainted.
> 
> This condition was apparently intended to avoid a crash if a force-
> loaded module has an incompatible definition of dynamic debug
> structures.  However, a administrator that forces us to load a module
> is claiming that it *is* compatible even though it fails our version
> checks.  If they are mistaken, there are any number of ways the module
> could crash the system.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Thanks, applied, unless Mathieu objects...

Cheers,
Rusty.

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

* Re: [PATCH] module: Enable dynamic debugging regardless of taint
  2011-11-01  4:41         ` Rusty Russell
@ 2011-11-01 12:48           ` Mathieu Desnoyers
  0 siblings, 0 replies; 7+ messages in thread
From: Mathieu Desnoyers @ 2011-11-01 12:48 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Ben Hutchings, Jason Baron, Nick Bowler, Greg KH, Dave Jones,
	Randy Dunlap, LKML, Debian kernel maintainers

* Rusty Russell (rusty@rustcorp.com.au) wrote:
> On Tue, 01 Nov 2011 03:59:33 +0000, Ben Hutchings <ben@decadent.org.uk> wrote:
> > Dynamic debugging is currently disabled for tainted modules, except
> > for TAINT_CRAP.  This prevents use of dynamic debugging for
> > out-of-tree modules now that they are also tainted.
> > 
> > This condition was apparently intended to avoid a crash if a force-
> > loaded module has an incompatible definition of dynamic debug
> > structures.  However, a administrator that forces us to load a module
> > is claiming that it *is* compatible even though it fails our version
> > checks.  If they are mistaken, there are any number of ways the module
> > could crash the system.
> > 
> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> 
> Thanks, applied, unless Mathieu objects...

I'm OK with that. We should probably note in the changelog the
side-effect of now supporting dynamic debugging of proprietary drivers.
If we start doing this for dynamic debugging, I'd be tempted to do it
for tracepoints and static jump labels too, since at least tracepoints
would not be the only "offender" (from an end-user point of view)
causing crashes on incompatible module load.

Thanks!

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

> 
> Cheers,
> Rusty.

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

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

end of thread, other threads:[~2011-11-01 12:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28  3:38 [PATCH 2/2] module: Re-enable dynamic debugging for GPL-compatible OOT modules Ben Hutchings
2011-10-31  1:59 ` Rusty Russell
2011-10-31 13:44   ` Ben Hutchings
2011-11-01  2:09     ` Rusty Russell
2011-11-01  3:59       ` [PATCH] module: Enable dynamic debugging regardless of taint Ben Hutchings
2011-11-01  4:41         ` Rusty Russell
2011-11-01 12:48           ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox