All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	the arch/x86 maintainers <x86@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [GIT PULL] x86 fix
Date: Sun, 5 Jul 2026 10:17:36 +0200	[thread overview]
Message-ID: <akoTIDQt3dmaA3yp@gmail.com> (raw)

Linus,

Please pull the latest x86/urgent Git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2026-07-05

for you to fetch changes up to fc16126cc11d9f507130bf84ab137ee0938c900e:

 - Prevent OOB access in the resctrl code while offlining
   CPUs when Intel SNC (Sub-NUMA Clustering) is enabled
   (Reinette Chatre)

Signed-off-by: Ingo Molnar <mingo@kernel.org>

 Thanks,

	Ingo

------------------>
Reinette Chatre (1):
      x86,fs/resctrl: Prevent out-of-bounds access while offlining CPU when SNC enabled


 arch/x86/kernel/cpu/resctrl/monitor.c |  5 +++++
 fs/resctrl/monitor.c                  | 39 ++++++++++++++++++++---------------
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index 03ee6102ab07..569894d6e5c8 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -259,6 +259,11 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain_hdr *hdr,
 	if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
 		return -EINVAL;
 
+	if (cpumask_empty(&hdr->cpu_mask)) {
+		pr_warn_once("Domain %d has no CPUs\n", hdr->id);
+		return -EINVAL;
+	}
+
 	d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
 	hw_dom = resctrl_to_arch_mon_dom(d);
 	cpu = cpumask_any(&hdr->cpu_mask);
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 0e6a389a16bf..a932a1fea818 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -135,10 +135,10 @@ void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free)
 	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
 	u32 idx_limit = resctrl_arch_system_num_rmid_idx();
 	struct rmid_entry *entry;
+	bool rmid_dirty = true;
 	u32 idx, cur_idx = 1;
 	void *arch_mon_ctx;
 	void *arch_priv;
-	bool rmid_dirty;
 	u64 val = 0;
 
 	arch_priv = mon_event_all[QOS_L3_OCCUP_EVENT_ID].arch_priv;
@@ -161,22 +161,27 @@ void __check_limbo(struct rdt_l3_mon_domain *d, bool force_free)
 			break;
 
 		entry = __rmid_entry(idx);
-		if (resctrl_arch_rmid_read(r, &d->hdr, entry->closid, entry->rmid,
-					   QOS_L3_OCCUP_EVENT_ID, arch_priv, &val,
-					   arch_mon_ctx)) {
-			rmid_dirty = true;
-		} else {
-			rmid_dirty = (val >= resctrl_rmid_realloc_threshold);
-
-			/*
-			 * x86's CLOSID and RMID are independent numbers, so the entry's
-			 * CLOSID is an empty CLOSID (X86_RESCTRL_EMPTY_CLOSID). On Arm the
-			 * RMID (PMG) extends the CLOSID (PARTID) space with bits that aren't
-			 * used to select the configuration. It is thus necessary to track both
-			 * CLOSID and RMID because there may be dependencies between them
-			 * on some architectures.
-			 */
-			trace_mon_llc_occupancy_limbo(entry->closid, entry->rmid, d->hdr.id, val);
+		if (!force_free) {
+			if (resctrl_arch_rmid_read(r, &d->hdr, entry->closid,
+						   entry->rmid, QOS_L3_OCCUP_EVENT_ID,
+						   arch_priv, &val, arch_mon_ctx)) {
+				rmid_dirty = true;
+			} else {
+				rmid_dirty = (val >= resctrl_rmid_realloc_threshold);
+
+				/*
+				 * x86's CLOSID and RMID are independent numbers,
+				 * so the entry's CLOSID is an empty CLOSID
+				 * (X86_RESCTRL_EMPTY_CLOSID). On Arm the RMID
+				 * (PMG) extends the CLOSID (PARTID) space with
+				 * bits that aren't used to select the configuration.
+				 * It is thus necessary to track both CLOSID and
+				 * RMID because there may be dependencies between
+				 * them on some architectures.
+				 */
+				trace_mon_llc_occupancy_limbo(entry->closid, entry->rmid,
+							      d->hdr.id, val);
+			}
 		}
 
 		if (force_free || !rmid_dirty) {

             reply	other threads:[~2026-07-05  8:17 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05  8:17 Ingo Molnar [this message]
2026-07-05 15:46 ` [GIT PULL] x86 fix pr-tracker-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-06-23 17:21 Ingo Molnar
2026-06-24  0:20 ` pr-tracker-bot
2026-05-17  6:42 Ingo Molnar
2026-05-17 19:28 ` pr-tracker-bot
2026-03-15  3:36 Ingo Molnar
2026-03-15 18:47 ` pr-tracker-bot
2026-01-11 10:32 Ingo Molnar
2026-01-12 19:38 ` pr-tracker-bot
2026-01-02 13:47 Ingo Molnar
2026-01-02 20:18 ` pr-tracker-bot
2025-09-20  8:28 Ingo Molnar
2025-09-20 17:02 ` pr-tracker-bot
2025-05-11  7:53 Ingo Molnar
2025-05-11 18:40 ` pr-tracker-bot
2025-05-11 18:40 ` pr-tracker-bot
2025-05-04  7:36 Ingo Molnar
2025-05-04 15:23 ` pr-tracker-bot
2025-03-14  9:14 Ingo Molnar
2025-03-14 20:14 ` pr-tracker-bot
2025-02-08  9:33 Ingo Molnar
2025-02-08 20:07 ` pr-tracker-bot
2025-01-21  7:28 [GIT PULL] x86/cleanups for v6.14 Ingo Molnar
2025-01-21 21:29 ` [GIT PULL] x86/boot enhancements " Ingo Molnar
2025-01-27  3:18   ` Linus Torvalds
2025-01-27 10:20     ` [PATCH] Revert "x86/boot: Reject absolute references in .head.text Ingo Molnar
2025-01-27 15:54       ` [GIT PULL] x86 fix Ingo Molnar
2025-01-27 17:10         ` Linus Torvalds
2025-01-28 22:19           ` Ingo Molnar
2025-01-28 22:22             ` Ingo Molnar
2025-01-28 22:39             ` pr-tracker-bot
2023-09-02 10:24 Ingo Molnar
2023-09-02 16:13 ` pr-tracker-bot
2022-08-13 10:40 Ingo Molnar
2022-08-13 21:48 ` pr-tracker-bot
2020-08-02 19:17 Ingo Molnar
2020-08-02 20:15 ` pr-tracker-bot
2020-04-02  9:51 Ingo Molnar
2020-04-02 22:00 ` Linus Torvalds
2020-04-02 22:45 ` pr-tracker-bot
2020-03-24  9:06 Ingo Molnar
2020-03-24 17:15 ` pr-tracker-bot
2019-12-17 11:58 Ingo Molnar
2019-12-17 19:20 ` pr-tracker-bot
2019-09-28 12:42 Ingo Molnar
2019-09-28 20:50 ` pr-tracker-bot
2019-07-14 11:32 Ingo Molnar
2019-07-14 18:45 ` pr-tracker-bot
2019-05-05 11:00 Ingo Molnar
2019-05-05 22:10 ` pr-tracker-bot
2018-07-21 12:55 Ingo Molnar
2016-07-25 15:54 Ingo Molnar
2015-05-15  7:26 Ingo Molnar
2015-03-28 13:58 Ingo Molnar
2015-02-06 18:41 Ingo Molnar
2014-12-19 12:16 Ingo Molnar
2014-04-19 10:58 Ingo Molnar
2013-11-19 15:48 Ingo Molnar
2013-09-28 18:23 Ingo Molnar
2013-07-10 14:32 Ingo Molnar
2012-10-23 11:06 Ingo Molnar
2012-10-23 15:00 ` H. Peter Anvin
2012-10-23 15:17   ` Borislav Petkov
2011-12-20 19:30 Ingo Molnar
2011-10-13  9:00 Ingo Molnar
2011-09-30 18:22 Ingo Molnar
2011-09-30 18:59 ` Jeremy Fitzhardinge
2011-09-30 19:44 ` Thomas Gleixner
2011-07-23  8:43 Ingo Molnar
2011-02-07 15:03 Ingo Molnar
2010-12-28 22:27 Ingo Molnar
2010-12-23 13:00 Ingo Molnar
2010-12-08  7:51 Ingo Molnar
2010-10-30 18:26 Ingo Molnar
2009-09-27  8:02 Ingo Molnar
2009-08-10 18:08 Ingo Molnar
2009-06-29  8:36 Ingo Molnar
2009-03-10 18:25 [git pull] " Ingo Molnar
2009-02-28 13:02 i915 needs pgprot_writecombine() and is_io_mapping_posible() Theodore Ts'o
2009-02-28 13:34 ` [git pull] x86 fix Ingo Molnar
2009-01-13  1:17 Ingo Molnar
2008-11-07 16:30 Ingo Molnar
2008-10-04 14:55 Ingo Molnar
2008-07-01 19:57 Ingo Molnar
2008-04-26 19:47 Ingo Molnar
2008-04-26 20:15 ` Harvey Harrison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=akoTIDQt3dmaA3yp@gmail.com \
    --to=mingo@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.