mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
8c149eb011
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>
25 lines
688 B
C
25 lines
688 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
|
|
#ifndef _TEST_CXL_WATERMARK_H_
|
|
#define _TEST_CXL_WATERMARK_H_
|
|
#include <linux/module.h>
|
|
#include <linux/printk.h>
|
|
|
|
int cxl_acpi_test(void);
|
|
int cxl_core_test(void);
|
|
int cxl_mem_test(void);
|
|
int cxl_pmem_test(void);
|
|
int cxl_port_test(void);
|
|
|
|
/*
|
|
* dummy routine for cxl_test to validate it is linking to the properly
|
|
* mocked module and not the standard one from the base tree.
|
|
*/
|
|
#define cxl_test_watermark(x) \
|
|
int x##_test(void) \
|
|
{ \
|
|
pr_debug("%s for cxl_test\n", KBUILD_MODNAME); \
|
|
return 0; \
|
|
} \
|
|
EXPORT_SYMBOL(x##_test)
|
|
#endif /* _TEST_CXL_WATERMARK_H_ */
|