+ kasan-mm-fix-crash-with-hw_tags-and-debug_pagealloc.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC
has been added to the -mm tree.  Its filename is
     kasan-mm-fix-crash-with-hw_tags-and-debug_pagealloc.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/kasan-mm-fix-crash-with-hw_tags-and-debug_pagealloc.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/kasan-mm-fix-crash-with-hw_tags-and-debug_pagealloc.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
Subject: kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC

Currently, kasan_free_nondeferred_pages()->kasan_free_pages() is called
after debug_pagealloc_unmap_pages().  This causes a crash when
debug_pagealloc is enabled, as HW_TAGS KASAN can't set tags on an unmapped
page.

This patch puts kasan_free_nondeferred_pages() before
debug_pagealloc_unmap_pages().

Besides fixing the crash, this also makes the annotation order consistent
with debug_pagealloc_map_pages() preceding kasan_alloc_pages().

Link: https://lkml.kernel.org/r/1aa83e48627978de8068d5e3314185f3a0d7a849.1614302398.git.andreyknvl@xxxxxxxxxx
Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Will Deacon <will.deacon@xxxxxxx>
Cc: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
Cc: Alexander Potapenko <glider@xxxxxxxxxx>
Cc: Marco Elver <elver@xxxxxxxxxx>
Cc: Peter Collingbourne <pcc@xxxxxxxxxx>
Cc: Evgenii Stepanov <eugenis@xxxxxxxxxx>
Cc: Branislav Rankov <Branislav.Rankov@xxxxxxx>
Cc: Kevin Brodsky <kevin.brodsky@xxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/page_alloc.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/mm/page_alloc.c~kasan-mm-fix-crash-with-hw_tags-and-debug_pagealloc
+++ a/mm/page_alloc.c
@@ -1288,10 +1288,14 @@ static __always_inline bool free_pages_p
 	 */
 	arch_free_page(page, order);
 
-	debug_pagealloc_unmap_pages(page, 1 << order);
-
+	/*
+	 * With hardware tag-based KASAN, memory tags must be set
+	 * before unmapping the page with debug_pagealloc.
+	 */
 	kasan_free_nondeferred_pages(page, order);
 
+	debug_pagealloc_unmap_pages(page, 1 << order);
+
 	return true;
 }
 
_

Patches currently in -mm which might be from andreyknvl@xxxxxxxxxx are

kasan-mm-fix-crash-with-hw_tags-and-debug_pagealloc.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux