tracepoint: Allow trace events in modules with TAINT_TEST

commit 54be5509422ebee333709c92441aa7185ca182fa
Author: Alison Schofield <alison.schofield@intel.com>
Date:   Mon Aug 29 10:10:48 2022 -0700

    tracepoint: Allow trace events in modules with TAINT_TEST

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

    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.

    Link: https://lkml.kernel.org/r/20220829171048.263065-1-alison.schofield@intel.com

    Fixes: 2852ca7fba9f7 ("panic: Taint kernel if tests are run")
    Reported-by: Ira Weiny <ira.weiny@intel.com>
    Suggested-by: Dan Williams <dan.j.williams@intel.com>
    Tested-by: Ira Weiny <ira.weiny@intel.com>
    Reviewed-by: David Gow <davidgow@google.com>
    Signed-off-by: Alison Schofield <alison.schofield@intel.com>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168378
Signed-off-by: Nico Pache <npache@redhat.com>
This commit is contained in:
Nico Pache 2023-02-22 13:05:29 -07:00
parent a7394fd676
commit f832057b71
1 changed files with 3 additions and 2 deletions

View File

@ -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);
@ -647,7 +648,7 @@ static int tracepoint_module_coming(struct module *mod)
/*
* 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, out-of-tree, and unsigned GPL modules are fine.
* Staging, out-of-tree, unsigned GPL, and test modules are fine.
*/
if (trace_module_has_bad_taint(mod))
return 0;