From be9224405fd420087ceb7865abb34d93e47fdd6a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 18 Feb 2023 12:57:26 +0100 Subject: [PATCH] 6.1-stable patches added patches: mm-extend-max-struct-page-size-for-kmsan.patch --- ...xtend-max-struct-page-size-for-kmsan.patch | 73 +++++++++++++++++++ queue-6.1/series | 1 + 2 files changed, 74 insertions(+) create mode 100644 queue-6.1/mm-extend-max-struct-page-size-for-kmsan.patch diff --git a/queue-6.1/mm-extend-max-struct-page-size-for-kmsan.patch b/queue-6.1/mm-extend-max-struct-page-size-for-kmsan.patch new file mode 100644 index 00000000000..78ce626178f --- /dev/null +++ b/queue-6.1/mm-extend-max-struct-page-size-for-kmsan.patch @@ -0,0 +1,73 @@ +From 3770e52fd4ec40ebee16ba19ad6c09dc0b52739b Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 30 Jan 2023 14:07:26 +0100 +Subject: mm: extend max struct page size for kmsan + +From: Arnd Bergmann + +commit 3770e52fd4ec40ebee16ba19ad6c09dc0b52739b upstream. + +After x86 enabled support for KMSAN, it has become possible to have larger +'struct page' than was expected when commit 5470dea49f53 ("mm: use +mm_zero_struct_page from SPARC on all 64b architectures") was merged: + +include/linux/mm.h:156:10: warning: no case matching constant switch condition '96' + switch (sizeof(struct page)) { + +Extend the maximum accordingly. + +Link: https://lkml.kernel.org/r/20230130130739.563628-1-arnd@kernel.org +Fixes: 5470dea49f53 ("mm: use mm_zero_struct_page from SPARC on all 64b architectures") +Fixes: 4ca8cc8d1bbe ("x86: kmsan: enable KMSAN builds for x86") +Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core") +Signed-off-by: Arnd Bergmann +Acked-by: Michal Hocko +Reviewed-by: Pasha Tatashin +Cc: Alexander Duyck +Cc: Alexander Potapenko +Cc: Alex Sierra +Cc: David Hildenbrand +Cc: Hugh Dickins +Cc: John Hubbard +Cc: Liam R. Howlett +Cc: Matthew Wilcox +Cc: Naoya Horiguchi +Cc: Suren Baghdasaryan +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/mm.h | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -136,7 +136,7 @@ extern int mmap_rnd_compat_bits __read_m + * define their own version of this macro in + */ + #if BITS_PER_LONG == 64 +-/* This function must be updated when the size of struct page grows above 80 ++/* This function must be updated when the size of struct page grows above 96 + * or reduces below 56. The idea that compiler optimizes out switch() + * statement, and only leaves move/store instructions. Also the compiler can + * combine write statements if they are both assignments and can be reordered, +@@ -147,12 +147,18 @@ static inline void __mm_zero_struct_page + { + unsigned long *_pp = (void *)page; + +- /* Check that struct page is either 56, 64, 72, or 80 bytes */ ++ /* Check that struct page is either 56, 64, 72, 80, 88 or 96 bytes */ + BUILD_BUG_ON(sizeof(struct page) & 7); + BUILD_BUG_ON(sizeof(struct page) < 56); +- BUILD_BUG_ON(sizeof(struct page) > 80); ++ BUILD_BUG_ON(sizeof(struct page) > 96); + + switch (sizeof(struct page)) { ++ case 96: ++ _pp[11] = 0; ++ fallthrough; ++ case 88: ++ _pp[10] = 0; ++ fallthrough; + case 80: + _pp[9] = 0; + fallthrough; diff --git a/queue-6.1/series b/queue-6.1/series index ccc622a6391..3e63051dc80 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -103,3 +103,4 @@ ixgbe-add-double-of-vlan-header-when-computing-the-max-mtu.patch ipv6-fix-datagram-socket-connection-with-dscp.patch ipv6-fix-tcp-socket-connection-with-dscp.patch mm-gup-add-folio-to-list-when-folio_isolate_lru-succeed.patch +mm-extend-max-struct-page-size-for-kmsan.patch -- 2.47.2