mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
tools/testing/cxl: Prevent cxl_test from confusing production modules
The cxl_test machinery builds modified versions of the modules in drivers/cxl/ and intercepts some of their calls to allow cxl_test to inject mock CXL topologies for test. However, if cxl_test attempts the same with production modules, fireworks ensue as Luis discovered [1]. Prevent that scenario by arranging for cxl_test to check for a "watermark" symbol in each of the modules it expects to be modified before the test can run. This turns undefined runtime behavior or crashes into a safer failure to load the cxl_test module. Link: http://lore.kernel.org/r/20221209062919.1096779-1-mcgrof@kernel.org [1] Reported-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/mm.h>
|
||||
#include <cxlmem.h>
|
||||
|
||||
#include "../watermark.h"
|
||||
#include "mock.h"
|
||||
|
||||
static int interleave_arithmetic;
|
||||
@@ -1119,6 +1121,12 @@ static __init int cxl_test_init(void)
|
||||
{
|
||||
int rc, i;
|
||||
|
||||
cxl_acpi_test();
|
||||
cxl_core_test();
|
||||
cxl_mem_test();
|
||||
cxl_pmem_test();
|
||||
cxl_port_test();
|
||||
|
||||
register_cxl_mock_ops(&cxl_mock_ops);
|
||||
|
||||
cxl_mock_pool = gen_pool_create(ilog2(SZ_2M), NUMA_NO_NODE);
|
||||
|
||||
Reference in New Issue
Block a user