lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250313060907.2381416-1-wangyuquan1236@phytium.com.cn>
Date: Thu, 13 Mar 2025 14:09:07 +0800
From: Yuquan Wang <wangyuquan1236@...tium.com.cn>
To: rafael@...nel.org,
	lenb@...nel.org,
	dave@...olabs.net,
	jonathan.cameron@...wei.com,
	dave.jiang@...el.com,
	alison.schofield@...el.com,
	vishal.l.verma@...el.com,
	ira.weiny@...el.com,
	dan.j.williams@...el.com,
	rrichter@....com,
	bfaccini@...dia.com,
	rppt@...nel.org,
	haibo1.xu@...el.com
Cc: chenbaozi@...tium.com.cn,
	linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-cxl@...r.kernel.org,
	Yuquan Wang <wangyuquan1236@...tium.com.cn>
Subject: [PATCH v2] ACPI: NUMA: debug invalid unused PXM value for CFMWs

The absence of SRAT would cause the fake_pxm to be -1 and increment
to 0, then send to acpi_parse_cfmws(). If there exists CXL memory
ranges that are defined in the CFMWS and not already defined in the
SRAT, the new node (node0) for the CXL memory would be invalid, as
node0 is already in "used".

This utilizes disable_srat() & srat_disabled() to fail CXL init.

Signed-off-by: Yuquan Wang <wangyuquan1236@...tium.com.cn>
---

Changes in v2:
- Add disable_srat() when fake_pxm is invalid
- Add srat_disabled() check in cxl_acpi_probe() and acpi_parse_cfmws()


 drivers/acpi/numa/srat.c | 10 ++++++++++
 drivers/cxl/acpi.c       |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
index 00ac0d7bb8c9..2dac25c9258a 100644
--- a/drivers/acpi/numa/srat.c
+++ b/drivers/acpi/numa/srat.c
@@ -441,6 +441,11 @@ static int __init acpi_parse_cfmws(union acpi_subtable_headers *header,
 	start = cfmws->base_hpa;
 	end = cfmws->base_hpa + cfmws->window_size;
 
+	if (srat_disabled()) {
+		pr_err("SRAT is missing or bad while processing CFMWS.\n");
+		return -EINVAL;
+	}
+
 	/*
 	 * The SRAT may have already described NUMA details for all,
 	 * or a portion of, this CFMWS HPA range. Extend the memblks
@@ -646,6 +651,11 @@ int __init acpi_numa_init(void)
 		if (node_to_pxm_map[i] > fake_pxm)
 			fake_pxm = node_to_pxm_map[i];
 	}
+
+	/* Make sure CFMWs fake nodes start at node[1] */
+	if (fake_pxm < 0)
+		disable_srat();
+
 	last_real_pxm = fake_pxm;
 	fake_pxm++;
 	acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, acpi_parse_cfmws,
diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
index cb14829bb9be..e75a8ead99f6 100644
--- a/drivers/cxl/acpi.c
+++ b/drivers/cxl/acpi.c
@@ -829,6 +829,10 @@ static int cxl_acpi_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
+	/* CXL must be in a NUMA system */
+	if (srat_disabled())
+		return -EINVAL;
+
 	cxl_res = devm_kzalloc(host, sizeof(*cxl_res), GFP_KERNEL);
 	if (!cxl_res)
 		return -ENOMEM;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ