From nobody Thu Jul 23 10:00:23 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4h5RSm1lV2z6lVyL for ; Thu, 23 Jul 2026 10:00:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h5RSl6PQcz3VCH for ; Thu, 23 Jul 2026 10:00:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784800823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+ZUSNx/a5Kll/tlC5Tj5nE/Y4sMPPD6p+m5Jlq0BV5o=; b=vJzgPDIRXie9IuZg+DLUJJQcRMxkNMBuicxDShrqhFoep0pdtizuqUWYEFQXWC4t9Aea+o PcJX12VMRpi4xugRAd3Q8JH3H/CiJaxIIda9MFTwklfF+wnltp/ySqDsIF90fRjElsP65w UPuchMazKf4evJLiu5oS7IfVYeUq+IOM06I0GWF5PPSN7l7VS8PX3Jwk+aCTAgD6ni7bKY nxJ8KVHsfDobz+EkOb69WbMtr94uhRxF/JEsO2zHQzQl7wHO7RsltZvGN9YSmBi3C6WjB1 LiM/5cTb0EpeKL7aRJfNJdRcKi7Ywp9pktvracxezTk+vPwBkuRtjBe7Je3p4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1784800823; a=rsa-sha256; cv=none; b=JfXFonioMQ3Un4pAKFQGBBvIfTain6QwlprxFU9VM3CDHI4tpjDgUCl5waJxU9H4S4zcRp qVHTlElVA38gKlfoUYNGpO2+pZMtOZHio42PPBsTHgsR6ItZPCTMKYQ+aiJl131zMrxFuR ZDnrMjrJdRjbaPvvnyr9T5EAw3iTTnA90RveEppmftlxgJvPfxsQ3IN3ATmmvS8eLxn2Kn q52cSwfbTb/c59mxIbLL6nUObiVrqOyUtHzAIwu7m/S1/Nj2KHytWlUwFEoJJotoXax8yi lxW/rp+B2I2cNRMHt/VEJ5tPKl95fDSqgojmlIYeUfxMQd/0Iok3TEl7NXMSgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1784800823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+ZUSNx/a5Kll/tlC5Tj5nE/Y4sMPPD6p+m5Jlq0BV5o=; b=T8oQDv5oEIWMEpFQ8ke6+t0i0Yit48gZwb4oOAggIHtCsX+71HbNPOwZw+N7ZC7rKouUho N+RdgFJkZJGiEJit4v8x0K4kgvBsVaGAeSYXexX2AbztLehwdj7LRVm4HHS1BjB2SoTqgT wvlotmsfWpOo1Y5B0SmTsTvLEqkrxslJUQXeLWCZ2BzUCN4kplWZR7/nYAryJ/UgtPOYfL hSXDoPMIFdz8wF8mnU1jMJ9tfp+Xr+wSeb8RUP7B0JiKP1CJf3dN0HpEdwaY96UDByGzt/ kOrRfUVxETCMs+E5ARsCQFIBDOa1zpkgkCqhKonDyydc7yjpQMUuu9cIV8dYUw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h5RSl50sDz10sN for ; Thu, 23 Jul 2026 10:00:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3bb34 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 23 Jul 2026 10:00:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 3f511fa41b3b - stable/14 - x86: x86_msr_op(): MSR_OP_LOCAL: Disable interrupts on atomic ops List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 3f511fa41b3bc846f1af7a6e7a3a5dd0b2dbf0ae Auto-Submitted: auto-generated Date: Thu, 23 Jul 2026 10:00:23 +0000 Message-Id: <6a61e637.3bb34.8fdb248@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=3f511fa41b3bc846f1af7a6e7a3a5dd0b2dbf0ae commit 3f511fa41b3bc846f1af7a6e7a3a5dd0b2dbf0ae Author: Olivier Certner AuthorDate: 2026-01-23 20:52:46 +0000 Commit: Olivier Certner CommitDate: 2026-07-23 09:58:59 +0000 x86: x86_msr_op(): MSR_OP_LOCAL: Disable interrupts on atomic ops On MSR_OP_LOCAL and non-naturally-atomic operations (MSR_OP_ANDNOT and MSR_OP_OR), there is no guarantee that we are not interrupted between reading and writing the MSR, and that interruption could actually perform some operation on that MSR, which would be lost. Prevent that problem by temporarily disabling interrupts around MSR manipulation. Reviewed by: kib Discussed with: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54996 (cherry picked from commit e5f8cbb86d58f25b5ff168506b78d09dca266fb6) --- sys/x86/include/x86_var.h | 2 ++ sys/x86/x86/cpu_machdep.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 0ff336c9c1f0..bd246623ec07 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -169,6 +169,8 @@ uint64_t rdtsc_ordered(void); /* * Where and which execution mode + * + * All modes cause execution on the target CPU(s) with interrupts disabled. */ #define MSR_OP_LOCAL 0x10000000 #define MSR_OP_SCHED_ALL 0x20000000 diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index ca975560fd1c..1c10af10e79d 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -161,6 +161,7 @@ x86_msr_op(u_int msr, u_int op, uint64_t arg1, uint64_t *res) struct thread *td; struct msr_op_arg a; cpuset_t set; + register_t flags; u_int exmode; int bound_cpu, cpu, i, is_bound; @@ -172,7 +173,9 @@ x86_msr_op(u_int msr, u_int op, uint64_t arg1, uint64_t *res) switch (exmode) { case MSR_OP_LOCAL: + flags = intr_disable(); x86_msr_op_one(&a); + intr_restore(flags); break; case MSR_OP_SCHED_ALL: td = curthread;