]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Apr 2023 16:57:52 +0000 (18:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Apr 2023 16:57:52 +0000 (18:57 +0200)
added patches:
mm-khugepaged-check-again-on-anon-uffd-wp-during-isolation.patch
mmc-sdhci_am654-set-high_speed_ena-for-sdr12-and-sdr25.patch

queue-5.10/mm-khugepaged-check-again-on-anon-uffd-wp-during-isolation.patch [new file with mode: 0644]
queue-5.10/mmc-sdhci_am654-set-high_speed_ena-for-sdr12-and-sdr25.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/mm-khugepaged-check-again-on-anon-uffd-wp-during-isolation.patch b/queue-5.10/mm-khugepaged-check-again-on-anon-uffd-wp-during-isolation.patch
new file mode 100644 (file)
index 0000000..ee0b7cf
--- /dev/null
@@ -0,0 +1,60 @@
+From dd47ac428c3f5f3bcabe845f36be870fe6c20784 Mon Sep 17 00:00:00 2001
+From: Peter Xu <peterx@redhat.com>
+Date: Wed, 5 Apr 2023 11:51:20 -0400
+Subject: mm/khugepaged: check again on anon uffd-wp during isolation
+
+From: Peter Xu <peterx@redhat.com>
+
+commit dd47ac428c3f5f3bcabe845f36be870fe6c20784 upstream.
+
+Khugepaged collapse an anonymous thp in two rounds of scans.  The 2nd
+round done in __collapse_huge_page_isolate() after
+hpage_collapse_scan_pmd(), during which all the locks will be released
+temporarily.  It means the pgtable can change during this phase before 2nd
+round starts.
+
+It's logically possible some ptes got wr-protected during this phase, and
+we can errornously collapse a thp without noticing some ptes are
+wr-protected by userfault.  e1e267c7928f wanted to avoid it but it only
+did that for the 1st phase, not the 2nd phase.
+
+Since __collapse_huge_page_isolate() happens after a round of small page
+swapins, we don't need to worry on any !present ptes - if it existed
+khugepaged will already bail out.  So we only need to check present ptes
+with uffd-wp bit set there.
+
+This is something I found only but never had a reproducer, I thought it
+was one caused a bug in Muhammad's recent pagemap new ioctl work, but it
+turns out it's not the cause of that but an userspace bug.  However this
+seems to still be a real bug even with a very small race window, still
+worth to have it fixed and copy stable.
+
+Link: https://lkml.kernel.org/r/20230405155120.3608140-1-peterx@redhat.com
+Fixes: e1e267c7928f ("khugepaged: skip collapse if uffd-wp detected")
+Signed-off-by: Peter Xu <peterx@redhat.com>
+Reviewed-by: David Hildenbrand <david@redhat.com>
+Reviewed-by: Yang Shi <shy828301@gmail.com>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: Axel Rasmussen <axelrasmussen@google.com>
+Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
+Cc: Nadav Amit <nadav.amit@gmail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/khugepaged.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/mm/khugepaged.c
++++ b/mm/khugepaged.c
+@@ -622,6 +622,10 @@ static int __collapse_huge_page_isolate(
+                       result = SCAN_PTE_NON_PRESENT;
+                       goto out;
+               }
++              if (pte_uffd_wp(pteval)) {
++                      result = SCAN_PTE_UFFD_WP;
++                      goto out;
++              }
+               page = vm_normal_page(vma, address, pteval);
+               if (unlikely(!page)) {
+                       result = SCAN_PAGE_NULL;
diff --git a/queue-5.10/mmc-sdhci_am654-set-high_speed_ena-for-sdr12-and-sdr25.patch b/queue-5.10/mmc-sdhci_am654-set-high_speed_ena-for-sdr12-and-sdr25.patch
new file mode 100644 (file)
index 0000000..c31ec60
--- /dev/null
@@ -0,0 +1,35 @@
+From 2265098fd6a6272fde3fd1be5761f2f5895bd99a Mon Sep 17 00:00:00 2001
+From: Bhavya Kapoor <b-kapoor@ti.com>
+Date: Fri, 17 Mar 2023 14:57:11 +0530
+Subject: mmc: sdhci_am654: Set HIGH_SPEED_ENA for SDR12 and SDR25
+
+From: Bhavya Kapoor <b-kapoor@ti.com>
+
+commit 2265098fd6a6272fde3fd1be5761f2f5895bd99a upstream.
+
+Timing Information in Datasheet assumes that HIGH_SPEED_ENA=1 should be
+set for SDR12 and SDR25 modes. But sdhci_am654 driver clears
+HIGH_SPEED_ENA register. Thus, Modify sdhci_am654 to not clear
+HIGH_SPEED_ENA (HOST_CONTROL[2]) bit for SDR12 and SDR25 speed modes.
+
+Fixes: e374e87538f4 ("mmc: sdhci_am654: Clear HISPD_ENA in some lower speed modes")
+Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20230317092711.660897-1-b-kapoor@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci_am654.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -351,8 +351,6 @@ static void sdhci_am654_write_b(struct s
+                */
+               case MMC_TIMING_SD_HS:
+               case MMC_TIMING_MMC_HS:
+-              case MMC_TIMING_UHS_SDR12:
+-              case MMC_TIMING_UHS_SDR25:
+                       val &= ~SDHCI_CTRL_HISPD;
+               }
+       }
index e29ec1b2beeaa2d513f1534b797a433383595127..9810ca5644eb57fb65be2a3d20a941710414fc3e 100644 (file)
@@ -31,3 +31,5 @@ iio-light-tsl2772-fix-reading-proximity-diodes-from-device-tree.patch
 nilfs2-initialize-unused-bytes-in-segment-summary-blocks.patch
 memstick-fix-memory-leak-if-card-device-is-never-registered.patch
 kernel-sys.c-fix-and-improve-control-flow-in-__sys_setresid.patch
+mmc-sdhci_am654-set-high_speed_ena-for-sdr12-and-sdr25.patch
+mm-khugepaged-check-again-on-anon-uffd-wp-during-isolation.patch