]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 May 2023 07:42:56 +0000 (08:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 May 2023 07:42:56 +0000 (08:42 +0100)
added patches:
selftests-memfd-fix-unknown-type-name-build-failure.patch
x86-mm-avoid-incomplete-global-invlpg-flushes.patch

queue-5.15/selftests-memfd-fix-unknown-type-name-build-failure.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/x86-mm-avoid-incomplete-global-invlpg-flushes.patch [new file with mode: 0644]

diff --git a/queue-5.15/selftests-memfd-fix-unknown-type-name-build-failure.patch b/queue-5.15/selftests-memfd-fix-unknown-type-name-build-failure.patch
new file mode 100644 (file)
index 0000000..6891edc
--- /dev/null
@@ -0,0 +1,38 @@
+From hargar@linux.microsoft.com  Sun May 28 08:40:32 2023
+From: Hardik Garg <hargar@linux.microsoft.com>
+Date: Fri, 26 May 2023 16:21:36 -0700
+Subject: selftests/memfd: Fix unknown type name build failure
+To: stable@vger.kernel.org
+Cc: shuah@kernel.org, jeffxu@google.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, code@tyhicks.com, niyelchu@linux.microsoft.com
+Message-ID: <20230526232136.255244-1-hargar@linux.microsoft.com>
+
+From: Hardik Garg <hargar@linux.microsoft.com>
+
+Partially backport v6.3 commit 11f75a01448f ("selftests/memfd: add tests
+for MFD_NOEXEC_SEAL MFD_EXEC") to fix an unknown type name build error.
+In some systems, the __u64 typedef is not present due to differences in
+system headers, causing compilation errors like this one:
+
+fuse_test.c:64:8: error: unknown type name '__u64'
+   64 | static __u64 mfd_assert_get_seals(int fd)
+
+This header includes the  __u64 typedef which increases the likelihood
+of successful compilation on a wider variety of systems.
+
+Signed-off-by: Hardik Garg <hargar@linux.microsoft.com>
+Reviewed-by: Tyler Hicks (Microsoft) <code@tyhicks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/memfd/fuse_test.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/tools/testing/selftests/memfd/fuse_test.c
++++ b/tools/testing/selftests/memfd/fuse_test.c
+@@ -22,6 +22,7 @@
+ #include <linux/falloc.h>
+ #include <fcntl.h>
+ #include <linux/memfd.h>
++#include <linux/types.h>
+ #include <sched.h>
+ #include <stdio.h>
+ #include <stdlib.h>
index 2b941ae473af7c3d7c48f114b6022ab17953c144..07dcb59d4e59f08d427cee9e30d20ac49d1ac9c5 100644 (file)
@@ -20,3 +20,5 @@ parisc-allow-to-reboot-machine-after-system-halt.patch
 gpio-mockup-fix-mode-of-debugfs-files.patch
 btrfs-use-nofs-when-cleaning-up-aborted-transactions.patch
 dt-binding-cdns-usb3-fix-cdns-on-chip-buff-size-type.patch
+x86-mm-avoid-incomplete-global-invlpg-flushes.patch
+selftests-memfd-fix-unknown-type-name-build-failure.patch
diff --git a/queue-5.15/x86-mm-avoid-incomplete-global-invlpg-flushes.patch b/queue-5.15/x86-mm-avoid-incomplete-global-invlpg-flushes.patch
new file mode 100644 (file)
index 0000000..53ec630
--- /dev/null
@@ -0,0 +1,101 @@
+From ce0b15d11ad837fbacc5356941712218e38a0a83 Mon Sep 17 00:00:00 2001
+From: Dave Hansen <dave.hansen@linux.intel.com>
+Date: Tue, 16 May 2023 12:24:25 -0700
+Subject: x86/mm: Avoid incomplete Global INVLPG flushes
+
+From: Dave Hansen <dave.hansen@linux.intel.com>
+
+commit ce0b15d11ad837fbacc5356941712218e38a0a83 upstream.
+
+The INVLPG instruction is used to invalidate TLB entries for a
+specified virtual address.  When PCIDs are enabled, INVLPG is supposed
+to invalidate TLB entries for the specified address for both the
+current PCID *and* Global entries.  (Note: Only kernel mappings set
+Global=1.)
+
+Unfortunately, some INVLPG implementations can leave Global
+translations unflushed when PCIDs are enabled.
+
+As a workaround, never enable PCIDs on affected processors.
+
+I expect there to eventually be microcode mitigations to replace this
+software workaround.  However, the exact version numbers where that
+will happen are not known today.  Once the version numbers are set in
+stone, the processor list can be tweaked to only disable PCIDs on
+affected processors with affected microcode.
+
+Note: if anyone wants a quick fix that doesn't require patching, just
+stick 'nopcid' on your kernel command-line.
+
+Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
+Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: stable@vger.kernel.org
+Signed-off-by: Daniel Sneddon <daniel.sneddon@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/intel-family.h |    5 +++++
+ arch/x86/mm/init.c                  |   25 +++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+)
+
+--- a/arch/x86/include/asm/intel-family.h
++++ b/arch/x86/include/asm/intel-family.h
+@@ -112,6 +112,11 @@
+ #define INTEL_FAM6_ALDERLAKE          0x97    /* Golden Cove / Gracemont */
+ #define INTEL_FAM6_ALDERLAKE_L                0x9A    /* Golden Cove / Gracemont */
++#define INTEL_FAM6_ALDERLAKE_N                0xBE
++
++#define INTEL_FAM6_RAPTORLAKE         0xB7
++#define INTEL_FAM6_RAPTORLAKE_P               0xBA
++#define INTEL_FAM6_RAPTORLAKE_S               0xBF
+ #define INTEL_FAM6_LUNARLAKE_M                0xBD
+--- a/arch/x86/mm/init.c
++++ b/arch/x86/mm/init.c
+@@ -9,6 +9,7 @@
+ #include <linux/sched/task.h>
+ #include <asm/set_memory.h>
++#include <asm/cpu_device_id.h>
+ #include <asm/e820/api.h>
+ #include <asm/init.h>
+ #include <asm/page.h>
+@@ -261,6 +262,24 @@ static void __init probe_page_size_mask(
+       }
+ }
++#define INTEL_MATCH(_model) { .vendor  = X86_VENDOR_INTEL,    \
++                            .family  = 6,                     \
++                            .model = _model,                  \
++                          }
++/*
++ * INVLPG may not properly flush Global entries
++ * on these CPUs when PCIDs are enabled.
++ */
++static const struct x86_cpu_id invlpg_miss_ids[] = {
++      INTEL_MATCH(INTEL_FAM6_ALDERLAKE   ),
++      INTEL_MATCH(INTEL_FAM6_ALDERLAKE_L ),
++      INTEL_MATCH(INTEL_FAM6_ALDERLAKE_N ),
++      INTEL_MATCH(INTEL_FAM6_RAPTORLAKE  ),
++      INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_P),
++      INTEL_MATCH(INTEL_FAM6_RAPTORLAKE_S),
++      {}
++};
++
+ static void setup_pcid(void)
+ {
+       if (!IS_ENABLED(CONFIG_X86_64))
+@@ -269,6 +288,12 @@ static void setup_pcid(void)
+       if (!boot_cpu_has(X86_FEATURE_PCID))
+               return;
++      if (x86_match_cpu(invlpg_miss_ids)) {
++              pr_info("Incomplete global flushes, disabling PCID");
++              setup_clear_cpu_cap(X86_FEATURE_PCID);
++              return;
++      }
++
+       if (boot_cpu_has(X86_FEATURE_PGE)) {
+               /*
+                * This can't be cr4_set_bits_and_update_boot() -- the