From nobody Tue Feb 10 20:14:46 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77084154454 for ; Mon, 22 Apr 2024 16:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713805138; cv=none; b=BdypewaEv2mU7mKMqt0cZhJove4cqa21QB/h2f8W/uaxTZNpASZwQLiSBsqIyMEgVQWQ5MiPFjitxo5RdF45AleOlt9Rv68vINsaMzgLxaDyVqy/CDsRPm5a6GNji5bHuwY7pNK8kYFZUORsgTLGIVt7EZvPmyPN3LkXGFwzw3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713805138; c=relaxed/simple; bh=3A12Je8N2N3tDKk5OJkio/7RhXVpNZtBOA/vmXVCnuo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HPNpP6ZsCvq08MiZzH6ogE0qcDP3s+8XRg8d2cycqPKmwpcqNLkllAvBR9L7j23JHCTOGx+78kfM1niVDYlCPAmb2ISKpjfEikFyy11AdzpuosZkHSTVg8UacnQbPW30ntr+OMNv2JjgIm/nTK2JaD+SoQXGHefIib/lXkj05dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-347c197a464so3489052f8f.2 for ; Mon, 22 Apr 2024 09:58:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713805135; x=1714409935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BYD1WGAneao6/IXWzO2Ys5ucl8QyNywmWKSSkk1/LxU=; b=Vr4CcIumQGzM1VmFfWnypZmULmakzNUja+FlGa64F2aic+D/NaCnYun1CqAxhHVnAd +rOsCott6f5r0qwnNXB4oo4XSR6DDc/5fOxkS0xyshbLgGKkr5U88KrWwtYmVRU4CYbS qT+A2pbMPr61MstIJuWPLLceH6rs43NsIW3nm27bFphi5CxX+sxwV0tjdPDWbHun5Hk5 McavKCFeI5roCHO68GUkNUHyOPoRfx7VHQFkti45xMrp5A64khbAj1Hu/qEKDUfzI5Zj ihJh0Hyi1rw5kXJgmUomKoXKgPsRX2279AqeJll1KfmOfocyvTQzjzKleR165mL6/omp sv1w== X-Gm-Message-State: AOJu0YxxdlghYeMj+Ire5a6kSaR+pYgpt6uMOGoIxK54/ERs+zphSLNn /TCJ+EERFj8lnXhbHOdK7PW/l71X8AcAhiKR9zKQLHnuvVG7+xsZ X-Google-Smtp-Source: AGHT+IElkgHGZ/eFalN1+eHYDS1LXVvvJEumR4Ymv77dPjVSsSzJCFl6lewge/1+OYwxdEHRGr/FXg== X-Received: by 2002:a5d:45c2:0:b0:34b:5d10:1d48 with SMTP id b2-20020a5d45c2000000b0034b5d101d48mr283794wrs.26.1713805134815; Mon, 22 Apr 2024 09:58:54 -0700 (PDT) Received: from localhost (fwdproxy-lla-003.fbsv.net. [2a03:2880:30ff:3::face:b00c]) by smtp.gmail.com with ESMTPSA id e14-20020a170906504e00b00a558014ab2csm4933932ejk.145.2024.04.22.09.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 09:58:54 -0700 (PDT) From: Breno Leitao To: jpoimboe@kernel.org, mingo@redhat.com, Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Pawan Gupta Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 04/10] x86/bugs: Add a separate config for MMIO Stable Data Date: Mon, 22 Apr 2024 09:58:18 -0700 Message-ID: <20240422165830.2142904-5-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422165830.2142904-1-leitao@debian.org> References: <20240422165830.2142904-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, the CONFIG_SPECULATION_MITIGATIONS is halfway populated, where some mitigations have entries in Kconfig, and they could be modified, while others mitigations do not have Kconfig entries, and could not be controlled at build time. Create an entry for the MMIO Stale data CPU mitigation under CONFIG_SPECULATION_MITIGATIONS. This allow users to enable or disable it at compilation time. Signed-off-by: Breno Leitao Acked-by: Josh Poimboeuf --- arch/x86/Kconfig | 12 ++++++++++++ arch/x86/kernel/cpu/bugs.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c7ce800fcdb2..bba5b65034dc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2673,6 +2673,18 @@ config MITIGATION_TAA which is available in various CPU internal buffers by using asynchronous aborts within an Intel TSX transactional region. See also + +config MITIGATION_MMIO_STALE_DATA + bool "Mitigate MMIO Stale Data hardware bug" + depends on CPU_SUP_INTEL + default y + help + Enable mitigation for MMIO Stale Data hardware bugs. Processor MMIO + Stale Data Vulnerabilities are a class of memory-mapped I/O (MMIO) + vulnerabilities that can expose data. The vulnerabilities require the + attacker to have access to MMIO. + See also + endif =20 config ARCH_HAS_ADD_PAGES diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 87f3cc6c438d..21daaf202b7f 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -393,7 +393,8 @@ enum mmio_mitigations { }; =20 /* Default mitigation for Processor MMIO Stale Data vulnerabilities */ -static enum mmio_mitigations mmio_mitigation __ro_after_init =3D MMIO_MITI= GATION_VERW; +static enum mmio_mitigations mmio_mitigation __ro_after_init =3D + IS_ENABLED(CONFIG_MITIGATION_MMIO_STALE_DATA) ? MMIO_MITIGATION_VERW : MM= IO_MITIGATION_OFF; static bool mmio_nosmt __ro_after_init =3D false; =20 static const char * const mmio_strings[] =3D { --=20 2.43.0