Skip to contentSkip to conversation

tracepoint: Allow trace events in modules with TAINT_TEST

PATCH Superseded [email protected] 3 participants 6 messages Aug 26, 2022 – Aug 29, 2022 Tracing

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracepoint: Allow trace events in modules with TAINT_TEST

From: Alison Schofield <[email protected]>

Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test has been run.

TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.

Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.

---
 kernel/tracepoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/tracepoint.c +2 -1
index 64ea283f2f86..5f17378c9dc2 100644
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
 bool trace_module_has_bad_taint(struct module *mod)
 {
 	return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
-			       (1 << TAINT_UNSIGNED_MODULE));
+			       (1 << TAINT_UNSIGNED_MODULE) |
+			       (1 << TAINT_TEST));
 }
 
 static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);

base-commit: 4c612826bec1441214816827979b62f84a097e91

Signature · 1 line
2.31.1
#1 lore raw
Quoted 5 lines · On 8/26/2022 3:35 PM, [email protected] wrote:

From: Alison Schofield <[email protected]>

Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test has been run.

has been loaded?

Quoted 33 lines

TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.

Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.

---
  kernel/tracepoint.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
kernel/tracepoint.c +2 -1
index 64ea283f2f86..5f17378c9dc2 100644
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
  bool trace_module_has_bad_taint(struct module *mod)
  {
  	return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
-			       (1 << TAINT_UNSIGNED_MODULE));
+			       (1 << TAINT_UNSIGNED_MODULE) |
+			       (1 << TAINT_TEST));
  }
 
  static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);

base-commit: 4c612826bec1441214816827979b62f84a097e91

#2 lore raw
Quoted 10 lines · Dave Jiang
Quoted 5 lines · On 8/26/2022 3:35 PM, [email protected] wrote:

From: Alison Schofield <[email protected]>

Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test has been run.

has been loaded?

I took that explanation directly from the mentioned commit, where it seems that 'run' was the intended word when referring to KUnit tests. Reviewer feedback led the submitter to make the taint per module to handle 'longer lasting' modules.

Quoted 32 lines
Quoted 32 lines

TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.

Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.

---
  kernel/tracepoint.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
kernel/tracepoint.c +2 -1
index 64ea283f2f86..5f17378c9dc2 100644
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
  bool trace_module_has_bad_taint(struct module *mod)
  {
  	return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
-			       (1 << TAINT_UNSIGNED_MODULE));
+			       (1 << TAINT_UNSIGNED_MODULE) |
+			       (1 << TAINT_TEST));
  }
  static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);
 

base-commit: 4c612826bec1441214816827979b62f84a097e91

#3 lore raw
In reply to [email protected]

+ David Gow - Submitter of the new taint type

Quoted 41 lines · On Fri, Aug 26, 2022 at 03:35:11PM -0700, [email protected] wrote:

From: Alison Schofield <[email protected]>

Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test has been run.

TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.

Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.

---
 kernel/tracepoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/tracepoint.c +2 -1
index 64ea283f2f86..5f17378c9dc2 100644
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
 bool trace_module_has_bad_taint(struct module *mod)
 {
 	return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
-			       (1 << TAINT_UNSIGNED_MODULE));
+			       (1 << TAINT_UNSIGNED_MODULE) |
+			       (1 << TAINT_TEST));
 }
 
 static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);

base-commit: 4c612826bec1441214816827979b62f84a097e91

Signature · 1 line
2.31.1
Reviewed-by
#4 lore raw
Quoted 23 lines · Alison Schofield

+ David Gow - Submitter of the new taint type

Quoted 19 lines · On Fri, Aug 26, 2022 at 03:35:11PM -0700, [email protected] wrote:

From: Alison Schofield <[email protected]>

Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test has been run.

TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.

Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.

---

This seems fine to me: thanks for catching it. Test modules should be safe enough to load for this.

Does the comment in tracepoint_module_coming() need updating as well?
https://elixir.bootlin.com/linux/v6.0-rc2/source/kernel/tracepoint.c#L650

Regardless, this is

Cheers,
-- David

Quoted 22 lines
Quoted 22 lines
 kernel/tracepoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/tracepoint.c +2 -1
index 64ea283f2f86..5f17378c9dc2 100644
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
 bool trace_module_has_bad_taint(struct module *mod)
 {
      return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
-                            (1 << TAINT_UNSIGNED_MODULE));
+                            (1 << TAINT_UNSIGNED_MODULE) |
+                            (1 << TAINT_TEST));
 }
 
 static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);

base-commit: 4c612826bec1441214816827979b62f84a097e91 --
2.31.1

#5 lore raw
Quoted 26 lines · David Gow
Quoted 23 lines · Alison Schofield

+ David Gow - Submitter of the new taint type

Quoted 19 lines · On Fri, Aug 26, 2022 at 03:35:11PM -0700, [email protected] wrote:

From: Alison Schofield <[email protected]>

Commit 2852ca7fba9f ("panic: Taint kernel if tests are run") introduced a new taint type, TAINT_TEST, to signal that an in-kernel test has been run.

TAINT_TEST taint type defaults into a 'bad_taint' list for kernel tracing and blocks the creation of trace events. This causes a problem for CXL testing where loading the cxl_test module makes all CXL modules out-of-tree, blocking any trace events.

Trace events are in development for CXL at the moment and this issue was found in test with v6.0-rc1.

---

Quoted 5 lines

This seems fine to me: thanks for catching it. Test modules should be safe enough to load for this.

Does the comment in tracepoint_module_coming() need updating as well?
https://elixir.bootlin.com/linux/v6.0-rc2/source/kernel/tracepoint.c#L650

Yes, ready in a v2:
- * Staging, out-of-tree, and unsigned GPL modules are fine.
+ * Staging, out-of-tree, unsigned GPL, and test modules are fine.

Thanks!
Alison

Quoted 29 lines

Regardless, this is

Cheers,
-- David

Quoted 22 lines
Quoted 22 lines
 kernel/tracepoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/tracepoint.c +2 -1
index 64ea283f2f86..5f17378c9dc2 100644
@@ -571,7 +571,8 @@ static void for_each_tracepoint_range(
 bool trace_module_has_bad_taint(struct module *mod)
 {
      return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
-                            (1 << TAINT_UNSIGNED_MODULE));
+                            (1 << TAINT_UNSIGNED_MODULE) |
+                            (1 << TAINT_TEST));
 }
 
 static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);

base-commit: 4c612826bec1441214816827979b62f84a097e91 --
2.31.1