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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251016144656.74928-6-yonch@yonch.com>
Date: Thu, 16 Oct 2025 09:46:53 -0500
From: Jonathan Perry <yonch@...ch.com>
To: Tony Luck <tony.luck@...el.com>,
	Reinette Chatre <reinette.chatre@...el.com>,
	linux-kernel@...r.kernel.org
Cc: linux-kselftest@...r.kernel.org,
	linux-doc@...r.kernel.org,
	Jonathan Corbet <corbet@....net>,
	James Morse <james.morse@....com>,
	Roman Storozhenko <romeusmeister@...il.com>,
	Jonathan Perry <yonch@...ch.com>
Subject: [PATCH 5/8] resctrl: Propagate CPU mask validation error via rr->err

When __mon_event_count() rejects a CPU because it is not in the
domain's mask (or does not match the cacheinfo domain), it returned
-EINVAL but did not set rr->err. mon_event_count() then discarded the
return value, which made failures harder to diagnose.

Set rr->err = -EINVAL before returning in both validation checks so
the error is visible to callers and can trigger WARN_ONCE() in the
PMU .read path.

Signed-off-by: Jonathan Perry <yonch@...ch.com>
---
 fs/resctrl/monitor.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 4076336fbba6..4d19c2ec823f 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -445,8 +445,10 @@ static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
 
 	if (rr->d) {
 		/* Reading a single domain, must be on a CPU in that domain. */
-		if (!cpumask_test_cpu(cpu, &rr->d->hdr.cpu_mask))
+		if (!cpumask_test_cpu(cpu, &rr->d->hdr.cpu_mask)) {
+			rr->err = -EINVAL;
 			return -EINVAL;
+		}
 		if (rr->is_mbm_cntr)
 			rr->err = resctrl_arch_cntr_read(rr->r, rr->d, closid, rmid, cntr_id,
 							 rr->evtid, &tval);
@@ -462,8 +464,10 @@ static int __mon_event_count(struct rdtgroup *rdtgrp, struct rmid_read *rr)
 	}
 
 	/* Summing domains that share a cache, must be on a CPU for that cache. */
-	if (!cpumask_test_cpu(cpu, &rr->ci->shared_cpu_map))
+	if (!cpumask_test_cpu(cpu, &rr->ci->shared_cpu_map)) {
+		rr->err = -EINVAL;
 		return -EINVAL;
+	}
 
 	/*
 	 * Legacy files must report the sum of an event across all

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ