mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch added to -mm tree
@ 2021-03-31  4:35 akpm
  2021-03-31  8:22 ` Stephen Rothwell
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2021-03-31  4:35 UTC (permalink / raw)
  To: andreyknvl, mm-commits, sfr, slyfox, vbabka


The patch titled
     Subject: mm, kasan: fix for "integrate page_alloc init with HW_TAGS"
has been added to the -mm tree.  Its filename is
     kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.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@google.com>
Subject: mm, kasan: fix for "integrate page_alloc init with HW_TAGS"

My commit "integrate page_alloc init with HW_TAGS" changed the order of
kernel_unpoison_pages() and kernel_init_free_pages() calls.  This leads to
complaints from the page unpoisoning code, as the poison pattern gets
overwritten for __GFP_ZERO allocations.

Fix by restoring the initial order. Also add a warning comment.

Link: https://lkml.kernel.org/r/65b6028dea2e9a6e8e2cb779b5115c09457363fc.1617122211.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Sergei Trofimovich <slyfox@gentoo.org>
Tested-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Sergei Trofimovich <slyfox@gentoo.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/page_alloc.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/mm/page_alloc.c~kasan-mm-integrate-page_alloc-init-with-hw_tags-fix
+++ a/mm/page_alloc.c
@@ -2331,6 +2331,13 @@ inline void post_alloc_hook(struct page
 	debug_pagealloc_map_pages(page, 1 << order);
 
 	/*
+	 * Page unpoisoning must happen before memory initialization.
+	 * Otherwise, the poison pattern will be overwritten for __GFP_ZERO
+	 * allocations and the page unpoisoning code will complain.
+	 */
+	kernel_unpoison_pages(page, 1 << order);
+
+	/*
 	 * As memory initialization might be integrated into KASAN,
 	 * kasan_alloc_pages and kernel_init_free_pages must be
 	 * kept together to avoid discrepancies in behavior.
@@ -2340,7 +2347,6 @@ inline void post_alloc_hook(struct page
 	if (init && !kasan_has_integrated_init())
 		kernel_init_free_pages(page, 1 << order);
 
-	kernel_unpoison_pages(page, 1 << order);
 	set_page_owner(page, order, gfp_flags);
 }
 
_

Patches currently in -mm which might be from andreyknvl@google.com are

kasan-initialize-shadow-to-tag_invalid-for-sw_tags.patch
mm-kasan-dont-poison-boot-memory-with-tag-based-modes.patch
arm64-kasan-allow-to-init-memory-when-setting-tags.patch
kasan-init-memory-in-kasan_unpoison-for-hw_tags.patch
kasan-mm-integrate-page_alloc-init-with-hw_tags.patch
kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch
kasan-mm-integrate-slab-init_on_alloc-with-hw_tags.patch
kasan-mm-integrate-slab-init_on_free-with-hw_tags.patch
kasan-docs-clean-up-sections.patch
kasan-docs-update-overview-section.patch
kasan-docs-update-usage-section.patch
kasan-docs-update-error-reports-section.patch
kasan-docs-update-boot-parameters-section.patch
kasan-docs-update-generic-implementation-details-section.patch
kasan-docs-update-sw_tags-implementation-details-section.patch
kasan-docs-update-hw_tags-implementation-details-section.patch
kasan-docs-update-shadow-memory-section.patch
kasan-docs-update-ignoring-accesses-section.patch
kasan-docs-update-tests-section.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch added to -mm tree
  2021-03-31  4:35 + kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch added to -mm tree akpm
@ 2021-03-31  8:22 ` Stephen Rothwell
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Rothwell @ 2021-03-31  8:22 UTC (permalink / raw)
  To: akpm; +Cc: andreyknvl, mm-commits, slyfox, vbabka

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

Hi all,

On Tue, 30 Mar 2021 21:35:28 -0700 akpm@linux-foundation.org wrote:
>
> The patch titled
>      Subject: mm, kasan: fix for "integrate page_alloc init with HW_TAGS"
> has been added to the -mm tree.  Its filename is
>      kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch

Added to linux-next today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-31  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  4:35 + kasan-mm-integrate-page_alloc-init-with-hw_tags-fix.patch added to -mm tree akpm
2021-03-31  8:22 ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).