]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2024 17:29:23 +0000 (18:29 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2024 17:29:23 +0000 (18:29 +0100)
added patches:
mm-huge_memory-don-t-force-huge-page-alignment-on-32-bit.patch

queue-6.1/mm-huge_memory-don-t-force-huge-page-alignment-on-32-bit.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/mm-huge_memory-don-t-force-huge-page-alignment-on-32-bit.patch b/queue-6.1/mm-huge_memory-don-t-force-huge-page-alignment-on-32-bit.patch
new file mode 100644 (file)
index 0000000..3c7525e
--- /dev/null
@@ -0,0 +1,55 @@
+From 4ef9ad19e17676b9ef071309bc62020e2373705d Mon Sep 17 00:00:00 2001
+From: Yang Shi <yang@os.amperecomputing.com>
+Date: Thu, 18 Jan 2024 10:05:05 -0800
+Subject: mm: huge_memory: don't force huge page alignment on 32 bit
+
+From: Yang Shi <yang@os.amperecomputing.com>
+
+commit 4ef9ad19e17676b9ef071309bc62020e2373705d upstream.
+
+commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP
+boundaries") caused two issues [1] [2] reported on 32 bit system or compat
+userspace.
+
+It doesn't make too much sense to force huge page alignment on 32 bit
+system due to the constrained virtual address space.
+
+[1] https://lore.kernel.org/linux-mm/d0a136a0-4a31-46bc-adf4-2db109a61672@kernel.org/
+[2] https://lore.kernel.org/linux-mm/CAJuCfpHXLdQy1a2B6xN2d7quTYwg2OoZseYPZTRpU0eHHKD-sQ@mail.gmail.com/
+
+Link: https://lkml.kernel.org/r/20240118180505.2914778-1-shy828301@gmail.com
+Fixes: efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries")
+Signed-off-by: Yang Shi <yang@os.amperecomputing.com>
+Reported-by: Jiri Slaby <jirislaby@kernel.org>
+Reported-by: Suren Baghdasaryan <surenb@google.com>
+Tested-by: Jiri Slaby <jirislaby@kernel.org>
+Tested-by: Suren Baghdasaryan <surenb@google.com>
+Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
+Cc: Rik van Riel <riel@surriel.com>
+Cc: Christopher Lameter <cl@linux.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/huge_memory.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -37,6 +37,7 @@
+ #include <linux/page_owner.h>
+ #include <linux/sched/sysctl.h>
+ #include <linux/memory-tiers.h>
++#include <linux/compat.h>
+ #include <asm/tlb.h>
+ #include <asm/pgalloc.h>
+@@ -607,6 +608,9 @@ static unsigned long __thp_get_unmapped_
+       loff_t off_align = round_up(off, size);
+       unsigned long len_pad, ret;
++      if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
++              return 0;
++
+       if (off_end <= off_align || (off_end - off_align) < size)
+               return 0;
index d93db114d8172c54a9066a30fbb0f34917863a05..b54787f2c7620b9cfd4d218d8354f585cd0ea291 100644 (file)
@@ -25,3 +25,4 @@ fs-ntfs3-fix-null-dereference-in-ni_write_inode.patch
 fs-ntfs3-fix-null-pointer-dereference-in-ni_write_in.patch
 iommu-arm-smmu-qcom-limit-the-smr-groups-to-128.patch
 rdma-core-fix-multiple-warray-bounds-warnings.patch
+mm-huge_memory-don-t-force-huge-page-alignment-on-32-bit.patch