From: Greg Kroah-Hartman Date: Wed, 12 May 2021 10:11:08 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v5.4.119~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a0db59374ece020da7f6b802258fb4112265f78d;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch --- diff --git a/queue-4.14/series b/queue-4.14/series index 7eac505172e..42e76f4d1f0 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -131,3 +131,4 @@ alsa-hda-realtek-re-order-alc882-sony-quirk-table-entries.patch alsa-hda-realtek-re-order-alc269-sony-quirk-table-entries.patch alsa-hda-realtek-re-order-alc269-lenovo-quirk-table-entries.patch alsa-hda-realtek-remove-redundant-entry-for-alc861-haier-uniwill-devices.patch +x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch diff --git a/queue-4.14/x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch b/queue-4.14/x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch new file mode 100644 index 00000000000..84f7298eb77 --- /dev/null +++ b/queue-4.14/x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch @@ -0,0 +1,43 @@ +From b6b4fbd90b155a0025223df2c137af8a701d53b3 Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Tue, 4 May 2021 15:56:31 -0700 +Subject: x86/cpu: Initialize MSR_TSC_AUX if RDTSCP *or* RDPID is supported + +From: Sean Christopherson + +commit b6b4fbd90b155a0025223df2c137af8a701d53b3 upstream. + +Initialize MSR_TSC_AUX with CPU node information if RDTSCP or RDPID is +supported. This fixes a bug where vdso_read_cpunode() will read garbage +via RDPID if RDPID is supported but RDTSCP is not. While no known CPU +supports RDPID but not RDTSCP, both Intel's SDM and AMD's APM allow for +RDPID to exist without RDTSCP, e.g. it's technically a legal CPU model +for a virtual machine. + +Note, technically MSR_TSC_AUX could be initialized if and only if RDPID +is supported since RDTSCP is currently not used to retrieve the CPU node. +But, the cost of the superfluous WRMSR is negigible, whereas leaving +MSR_TSC_AUX uninitialized is just asking for future breakage if someone +decides to utilize RDTSCP. + +Fixes: a582c540ac1b ("x86/vdso: Use RDPID in preference to LSL when available") +Signed-off-by: Sean Christopherson +Signed-off-by: Thomas Gleixner +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20210504225632.1532621-2-seanjc@google.com +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/entry/vdso/vma.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/entry/vdso/vma.c ++++ b/arch/x86/entry/vdso/vma.c +@@ -342,7 +342,7 @@ static void vgetcpu_cpu_init(void *arg) + #ifdef CONFIG_NUMA + node = cpu_to_node(cpu); + #endif +- if (static_cpu_has(X86_FEATURE_RDTSCP)) ++ if (boot_cpu_has(X86_FEATURE_RDTSCP) || boot_cpu_has(X86_FEATURE_RDPID)) + write_rdtscp_aux((node << 12) | cpu); + + /*