public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, "René Rebe" <rene@exactcode.de>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	stable@kernel.org
Subject: [PATCH 4.19 35/98] x86/cpu: Fix AMD erratum #1485 on Zen4-based CPUs
Date: Mon, 23 Oct 2023 12:56:24 +0200	[thread overview]
Message-ID: <20231023104814.837660899@linuxfoundation.org> (raw)
In-Reply-To: <20231023104813.580375891@linuxfoundation.org>

4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Borislav Petkov (AMD) <bp@alien8.de>

commit f454b18e07f518bcd0c05af17a2239138bff52de upstream.

Fix erratum #1485 on Zen4 parts where running with STIBP disabled can
cause an #UD exception. The performance impact of the fix is negligible.

Reported-by: René Rebe <rene@exactcode.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: René Rebe <rene@exactcode.de>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/D99589F4-BC5D-430B-87B2-72C20370CF57@exactcode.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/include/asm/msr-index.h |    4 ++++
 arch/x86/kernel/cpu/amd.c        |    8 ++++++++
 2 files changed, 12 insertions(+)

--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -446,6 +446,10 @@
 
 #define MSR_AMD64_VIRT_SPEC_CTRL	0xc001011f
 
+/* Zen4 */
+#define MSR_ZEN4_BP_CFG			0xc001102e
+#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
+
 /* Fam 17h MSRs */
 #define MSR_F17H_IRPERF			0xc00000e9
 
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -72,6 +72,10 @@ static const int amd_zenbleed[] =
 			   AMD_MODEL_RANGE(0x17, 0x90, 0x0, 0x91, 0xf),
 			   AMD_MODEL_RANGE(0x17, 0xa0, 0x0, 0xaf, 0xf));
 
+static const int amd_erratum_1485[] =
+	AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf),
+			   AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf));
+
 static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)
 {
 	int osvw_id = *erratum++;
@@ -1122,6 +1126,10 @@ static void init_amd(struct cpuinfo_x86
 	check_null_seg_clears_base(c);
 
 	zenbleed_check(c);
+
+	if (!cpu_has(c, X86_FEATURE_HYPERVISOR) &&
+	     cpu_has_amd_erratum(c, amd_erratum_1485))
+		msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);
 }
 
 #ifdef CONFIG_X86_32



  parent reply	other threads:[~2023-10-23 11:17 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 10:55 [PATCH 4.19 00/98] 4.19.297-rc1 review Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 01/98] indirect call wrappers: helpers to speed-up indirect calls of builtin Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 02/98] net: use indirect calls helpers at the socket layer Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 03/98] net: fix kernel-doc warnings for socket.c Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 04/98] net: prevent rewrite of msg_name in sock_sendmsg() Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 05/98] RDMA/cxgb4: Check skb value for failure to allocate Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 06/98] platform/x86: hp-wmi:: Mark driver struct with __refdata to prevent section mismatch warning Greg Kroah-Hartman
2023-10-23 16:40   ` Uwe Kleine-König
2023-10-24  7:50     ` Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 07/98] HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 08/98] quota: Fix slow quotaoff Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 09/98] net: prevent address rewrite in kernel_bind() Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 10/98] drm: etvnaviv: fix bad backport leading to warning Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 11/98] drm/msm/dsi: skip the wait for video mode done if not applicable Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 12/98] ieee802154: ca8210: Fix a potential UAF in ca8210_probe Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 13/98] xen-netback: use default TX queue size for vifs Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 14/98] drm/vmwgfx: fix typo of sizeof argument Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 15/98] ixgbe: fix crash with empty VF macvlan list Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 16/98] net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 17/98] nfc: nci: assert requested protocol is valid Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 18/98] workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 19/98] sched,idle,rcu: Push rcu_idle deeper into the idle path Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 20/98] dmaengine: stm32-mdma: abort resume if no ongoing transfer Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 21/98] usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 22/98] net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 23/98] usb: dwc3: Soft reset phy on probe for host Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 24/98] usb: musb: Get the musb_qh poniter after musb_giveback Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 25/98] usb: musb: Modify the "HWVers" register address Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 26/98] iio: pressure: bmp280: Fix NULL pointer exception Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 27/98] iio: pressure: ms5611: ms5611_prom_is_valid false negative bug Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 28/98] mcb: remove is_added flag from mcb_device struct Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 29/98] ceph: fix incorrect revoked caps assert in ceph_fill_file_size() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 30/98] Input: powermate - fix use-after-free in powermate_config_complete Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 31/98] Input: psmouse - fix fast_reconnect function for PS/2 mode Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 32/98] Input: xpad - add PXN V900 support Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 33/98] cgroup: Remove duplicates in cgroup v1 tasks file Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 34/98] pinctrl: avoid unsafe code pattern in find_pinctrl() Greg Kroah-Hartman
2023-10-23 10:56 ` Greg Kroah-Hartman [this message]
2023-10-23 10:56 ` [PATCH 4.19 36/98] usb: gadget: udc-xilinx: replace memcpy with memcpy_toio Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 37/98] usb: gadget: ncm: Handle decoding of multiple NTBs in unwrap call Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 38/98] powerpc/64e: Fix wrong test in __ptep_test_and_clear_young() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 39/98] x86/alternatives: Disable KASAN in apply_alternatives() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 40/98] dev_forward_skb: do not scrub skb mark within the same name space Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 41/98] usb: hub: Guard against accesses to uninitialized BOS descriptors Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 42/98] Bluetooth: hci_event: Ignore NULL link key Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 43/98] Bluetooth: Reject connection with the device which has same BD_ADDR Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 44/98] Bluetooth: Fix a refcnt underflow problem for hci_conn Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 45/98] Bluetooth: vhci: Fix race when opening vhci device Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 46/98] Bluetooth: hci_event: Fix coding style Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 47/98] Bluetooth: avoid memcmp() out of bounds warning Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 48/98] nfc: nci: fix possible NULL pointer dereference in send_acknowledge() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 49/98] regmap: fix NULL deref on lookup Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 50/98] KVM: x86: Mask LVTPC when handling a PMI Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 51/98] netfilter: nft_payload: fix wrong mac header matching Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 52/98] xfrm: fix a data-race in xfrm_gen_index() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 53/98] xfrm: interface: use DEV_STATS_INC() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 54/98] net: ipv4: fix return value check in esp_remove_trailer Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 55/98] net: ipv6: " Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 56/98] net: rfkill: gpio: prevent value glitch during probe Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 57/98] tcp: fix excessive TLP and RACK timeouts from HZ rounding Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 58/98] tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 59/98] net: usb: smsc95xx: Fix an error code in smsc95xx_reset() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 60/98] i40e: prevent crash on probe if hw registers have invalid values Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 61/98] net/sched: sch_hfsc: upgrade rt to sc when it becomes a inner curve Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 62/98] netfilter: nft_set_rbtree: .deactivate fails if element has expired Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 63/98] net: pktgen: Fix interface flags printing Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 64/98] libceph: fix unaligned accesses in ceph_entity_addr handling Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 65/98] libceph: use kernel_connect() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 66/98] ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 67/98] btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 68/98] btrfs: initialize start_slot in btrfs_log_prealloc_extents Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 69/98] i2c: mux: Avoid potential false error message in i2c_mux_add_adapter Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 70/98] overlayfs: set ctime when setting mtime and atime Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 71/98] gpio: timberdale: Fix potential deadlock on &tgpio->lock Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 72/98] ata: libata-eh: Fix compilation warning in ata_eh_link_report() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 73/98] tracing: relax trace_event_eval_update() execution with cond_resched() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 74/98] HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 75/98] Bluetooth: Avoid redundant authentication Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 76/98] Bluetooth: hci_core: Fix build warnings Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 77/98] wifi: mac80211: allow transmitting EAPOL frames with tainted key Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 78/98] wifi: cfg80211: avoid leaking stack data into trace Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 79/98] sky2: Make sure there is at least one frag_addr available Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 80/98] drm: panel-orientation-quirks: Add quirk for One Mix 2S Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 81/98] btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 82/98] Bluetooth: hci_event: Fix using memcmp when comparing keys Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 83/98] mtd: rawnand: qcom: Unmap the right resource upon probe failure Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 84/98] mtd: spinand: micron: correct bitmask for ecc status Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 85/98] mmc: core: Capture correct oemid-bits for eMMC cards Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 86/98] Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()" Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 87/98] ACPI: irq: Fix incorrect return value in acpi_register_gsi() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 88/98] USB: serial: option: add Telit LE910C4-WWX 0x1035 composition Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 89/98] USB: serial: option: add entry for Sierra EM9191 with new firmware Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 90/98] USB: serial: option: add Fibocom to DELL custom modem FM101R-GL Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 91/98] perf: Disallow mis-matched inherited group reads Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 92/98] s390/pci: fix iommu bitmap allocation Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 93/98] gpio: vf610: set value before the direction to avoid a glitch Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 94/98] ASoC: pxa: fix a memory leak in probe() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 95/98] phy: mapphone-mdm6600: Fix runtime PM for remove Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 96/98] Bluetooth: hci_sock: fix slab oob read in create_monitor_event Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 97/98] Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 98/98] xfrm6: fix inet6_dev refcount underflow problem Greg Kroah-Hartman
2023-10-23 20:42 ` [PATCH 4.19 00/98] 4.19.297-rc1 review Pavel Machek
2023-10-24  8:34 ` Daniel Díaz
2023-10-24  8:58 ` Sudip Mukherjee (Codethink)
2023-10-24 18:11 ` Guenter Roeck
2023-10-25 18:57 ` Jon Hunter

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=20231023104814.837660899@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bp@alien8.de \
    --cc=patches@lists.linux.dev \
    --cc=rene@exactcode.de \
    --cc=stable@kernel.org \
    --cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox