linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][GIT PULL][v3.3] tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT
@ 2012-01-15 20:10 Steven Rostedt
  2012-01-16  7:24 ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2012-01-15 20:10 UTC (permalink / raw)
  To: LKML, stable
  Cc: Ingo Molnar, Mathieu Desnoyers, Ben Hutchings, Dave Jones,
	Greg Kroah-Hartman, Rusty Russell, Andrew Morton, David Daney

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


Ingo,

I was told when compiling modules out of tree, their tracepoints no
longer work. I tried it out by compiling the sample trace_event code,
and sure enough the tracepoints would not enable. They would look like
they were enabled, but no tracing would happen. I ran this through ktest
git bisect, and found it was caused by the commit:

commit 2449b8ba0745327c5fa49a8d9acffe03b2eded69
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Mon Oct 24 15:12:28 2011 +0200

    module,bug: Add TAINT_OOT_MODULE flag for modules not built in-tree

Then I looked at the tracepoint.c code, and found that it does not
enable tracepoints in any module that is tainted. This restriction
should not apply to out-of-tree or staging modules. Which this patch
fixes.

Note, I've included this on top of my last "urgent" branch which I
noticed that was pulled into perf/core.

https://lkml.org/lkml/2012/1/6/357

I still think it's a good idea to include both into mainline now. They
are both marked for the stable release as well.

Thanks!

-- Steve


Please pull the latest tip/perf/urgent tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/urgent

Head SHA1: a4bd073dcd870c3eac1505eb8f0abe35d38cc98d


Steven Rostedt (1):
      tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT

----
 kernel/tracepoint.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---------------------------
commit a4bd073dcd870c3eac1505eb8f0abe35d38cc98d
Author: Steven Rostedt <srostedt@redhat.com>
Date:   Fri Jan 13 21:40:59 2012 -0500

    tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT
    
    Tracepoints are disabled for tainted modules, which is usually because the
    module is either proprietary or was forced, and we don't want either of them
    using kernel tracepoints.
    
    But, a module can also be tainted by being in the staging directory or
    compiled out of tree. Either is fine for use with tracepoints, no need
    to punish them.  I found this out when I noticed that my sample trace event
    module, when done out of tree, stopped working.
    
    Cc: stable@vger.kernel.org # 3.2
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Ben Hutchings <ben@decadent.org.uk>
    Cc: Dave Jones <davej@redhat.com>
    Cc: Greg Kroah-Hartman <gregkh@suse.de>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index db110b8..dc63553 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -636,8 +636,9 @@ static int tracepoint_module_coming(struct module *mod)
 	/*
 	 * We skip modules that tain the kernel, especially those with different
 	 * module header (for forced load), to make sure we don't cause a crash.
+	 * Staging and out-of-tree modules are fine.
 	 */
-	if (mod->taints)
+	if (mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP)))
 		return 0;
 	mutex_lock(&tracepoints_mutex);
 	tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL);


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

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

* Re: [PATCH][GIT PULL][v3.3] tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT
  2012-01-15 20:10 [PATCH][GIT PULL][v3.3] tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT Steven Rostedt
@ 2012-01-16  7:24 ` Ingo Molnar
  2012-01-16 16:38   ` [PATCH][GIT PULL v2][v3.3] " Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2012-01-16  7:24 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, stable, Mathieu Desnoyers, Ben Hutchings, Dave Jones,
	Greg Kroah-Hartman, Rusty Russell, Andrew Morton, David Daney


* Steven Rostedt <rostedt@goodmis.org> wrote:

>  	/*
>  	 * We skip modules that tain the kernel, especially those with different

While touching this commit we might as well fix the typo here?

>  	 * module header (for forced load), to make sure we don't cause a crash.

... and the second typo as well?

> +	 * Staging and out-of-tree modules are fine.
>  	 */

I'd phrase it as 'out-of-tree GPL modules'.

Thanks,

	Ingo

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

* [PATCH][GIT PULL v2][v3.3] tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT
  2012-01-16  7:24 ` Ingo Molnar
@ 2012-01-16 16:38   ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2012-01-16 16:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, stable, Mathieu Desnoyers, Ben Hutchings, Dave Jones,
	Greg Kroah-Hartman, Rusty Russell, Andrew Morton, David Daney

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

On Mon, 2012-01-16 at 08:24 +0100, Ingo Molnar wrote:
> * Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> >  	/*
> >  	 * We skip modules that tain the kernel, especially those with different
> 
> While touching this commit we might as well fix the typo here?
> 
> >  	 * module header (for forced load), to make sure we don't cause a crash.
> 
> ... and the second typo as well?
> 
> > +	 * Staging and out-of-tree modules are fine.
> >  	 */
> 
> I'd phrase it as 'out-of-tree GPL modules'.

Thanks!

Updated:

Please pull the latest tip/perf/urgent-2 tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/urgent-2

Head SHA1: c10076c4304083af15a41f6bc5e657e781c1f9a6


Steven Rostedt (1):
      tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT

----
 kernel/tracepoint.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---------------------------
commit c10076c4304083af15a41f6bc5e657e781c1f9a6
Author: Steven Rostedt <srostedt@redhat.com>
Date:   Fri Jan 13 21:40:59 2012 -0500

    tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT
    
    Tracepoints are disabled for tainted modules, which is usually because the
    module is either proprietary or was forced, and we don't want either of them
    using kernel tracepoints.
    
    But, a module can also be tainted by being in the staging directory or
    compiled out of tree. Either is fine for use with tracepoints, no need
    to punish them.  I found this out when I noticed that my sample trace event
    module, when done out of tree, stopped working.
    
    Cc: stable@vger.kernel.org # 3.2
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Ben Hutchings <ben@decadent.org.uk>
    Cc: Dave Jones <davej@redhat.com>
    Cc: Greg Kroah-Hartman <gregkh@suse.de>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index db110b8..f1539de 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -634,10 +634,11 @@ static int tracepoint_module_coming(struct module *mod)
 	int ret = 0;
 
 	/*
-	 * We skip modules that tain the kernel, especially those with different
-	 * module header (for forced load), to make sure we don't cause a crash.
+	 * We skip modules that taint the kernel, especially those with different
+	 * module headers (for forced load), to make sure we don't cause a crash.
+	 * Staging and out-of-tree GPL modules are fine.
 	 */
-	if (mod->taints)
+	if (mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP)))
 		return 0;
 	mutex_lock(&tracepoints_mutex);
 	tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL);


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

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

end of thread, other threads:[~2012-01-16 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15 20:10 [PATCH][GIT PULL][v3.3] tracepoints/module: Fix disabling tracepoints with taint CRAP or OOT Steven Rostedt
2012-01-16  7:24 ` Ingo Molnar
2012-01-16 16:38   ` [PATCH][GIT PULL v2][v3.3] " Steven Rostedt

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).