From: Greg Kroah-Hartman Date: Tue, 16 Aug 2022 12:22:12 +0000 (+0200) Subject: 5.18-stable patches X-Git-Tag: v5.15.61~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1fb81aed2d27b349aad7ade4098084f255090540;p=thirdparty%2Fkernel%2Fstable-queue.git 5.18-stable patches added patches: mm-introduce-clear_highpage_kasan_tagged.patch --- diff --git a/queue-5.18/mm-introduce-clear_highpage_kasan_tagged.patch b/queue-5.18/mm-introduce-clear_highpage_kasan_tagged.patch new file mode 100644 index 00000000000..ea020dbe7e9 --- /dev/null +++ b/queue-5.18/mm-introduce-clear_highpage_kasan_tagged.patch @@ -0,0 +1,64 @@ +From d9da8f6cf55eeca642c021912af1890002464c64 Mon Sep 17 00:00:00 2001 +From: Andrey Konovalov +Date: Thu, 9 Jun 2022 20:18:46 +0200 +Subject: mm: introduce clear_highpage_kasan_tagged + +From: Andrey Konovalov + +commit d9da8f6cf55eeca642c021912af1890002464c64 upstream. + +Add a clear_highpage_kasan_tagged() helper that does clear_highpage() on a +page potentially tagged by KASAN. + +This helper is used by the following patch. + +Link: https://lkml.kernel.org/r/4471979b46b2c487787ddcd08b9dc5fedd1b6ffd.1654798516.git.andreyknvl@google.com +Signed-off-by: Andrey Konovalov +Cc: Alexander Potapenko +Cc: Andrey Ryabinin +Cc: Dmitry Vyukov +Cc: Marco Elver +Signed-off-by: Andrew Morton +Cc: Jiri Slaby +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/highmem.h | 10 ++++++++++ + mm/page_alloc.c | 8 ++------ + 2 files changed, 12 insertions(+), 6 deletions(-) + +--- a/include/linux/highmem.h ++++ b/include/linux/highmem.h +@@ -218,6 +218,16 @@ static inline void clear_highpage(struct + kunmap_local(kaddr); + } + ++static inline void clear_highpage_kasan_tagged(struct page *page) ++{ ++ u8 tag; ++ ++ tag = page_kasan_tag(page); ++ page_kasan_tag_reset(page); ++ clear_highpage(page); ++ page_kasan_tag_set(page, tag); ++} ++ + #ifndef __HAVE_ARCH_TAG_CLEAR_HIGHPAGE + + static inline void tag_clear_highpage(struct page *page) +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -1287,12 +1287,8 @@ static void kernel_init_free_pages(struc + + /* s390's use of memset() could override KASAN redzones. */ + kasan_disable_current(); +- for (i = 0; i < numpages; i++) { +- u8 tag = page_kasan_tag(page + i); +- page_kasan_tag_reset(page + i); +- clear_highpage(page + i); +- page_kasan_tag_set(page + i, tag); +- } ++ for (i = 0; i < numpages; i++) ++ clear_highpage_kasan_tagged(page + i); + kasan_enable_current(); + } + diff --git a/queue-5.18/series b/queue-5.18/series index 1410e3e0bc0..57d3642e560 100644 --- a/queue-5.18/series +++ b/queue-5.18/series @@ -1091,3 +1091,4 @@ drm-vc4-change-vc4_dma_range_matches-from-a-global-to-static.patch f2fs-fix-null-ptr-deref-in-f2fs_get_dnode_of_data.patch io_uring-mem-account-pbuf-buckets.patch bluetooth-l2cap-fix-l2cap_global_chan_by_psm-regression.patch +mm-introduce-clear_highpage_kasan_tagged.patch