From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,ziy@nvidia.com,david@redhat.com,anshuman.khandual@arm.com,ritesh.list@gmail.com,akpm@linux-foundation.org
Subject: [merged mm-stable] cma-enforce-non-zero-pageblock_order-during-cma_init_reserved_mem.patch removed from -mm tree
Date: Thu, 14 Nov 2024 22:50:04 -0800 [thread overview]
Message-ID: <20241115065007.4CB2AC4CECF@smtp.kernel.org> (raw)
The quilt patch titled
Subject: cma: enforce non-zero pageblock_order during cma_init_reserved_mem()
has been removed from the -mm tree. Its filename was
cma-enforce-non-zero-pageblock_order-during-cma_init_reserved_mem.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Subject: cma: enforce non-zero pageblock_order during cma_init_reserved_mem()
Date: Wed, 13 Nov 2024 19:49:54 +0530
cma_init_reserved_mem() checks base and size alignment with
CMA_MIN_ALIGNMENT_BYTES. However, some users might call this during early
boot when pageblock_order is 0. That means if base and size does not have
pageblock_order alignment, it can cause functional failures during cma
activate area.
So let's enforce pageblock_order to be non-zero during
cma_init_reserved_mem() to catch such wrong usages.
1. This was seen with fadump on PowerPC which was calling
cma_init_reserved_mem() before the pageblock_order was initialized.
This is now fixed in the fadump on PowerPC itself. The details of that
can be found in the patch including the userspace-visible effect of the
issue [1].
2. However it was also decided that we should add a stronger
enforcement check within cma_init_reserved_mem() to catch such wrong
usages [2]. Hence this patch. This is ok to be in -next and there is
no "Fixes" tag required for this patch.
[1]: https://lore.kernel.org/all/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.list@gmail.com/
[2]: https://lore.kernel.org/all/83eb128e-4f06-4725-a843-a4563f246a44@redhat.com/
Link: https://lkml.kernel.org/r/e274344b44d5f80fa54c52f530387257fe99ec65.1731505681.git.ritesh.list@gmail.com
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/cma.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/mm/cma.c~cma-enforce-non-zero-pageblock_order-during-cma_init_reserved_mem
+++ a/mm/cma.c
@@ -181,6 +181,15 @@ int __init cma_init_reserved_mem(phys_ad
if (!size || !memblock_is_region_reserved(base, size))
return -EINVAL;
+ /*
+ * CMA uses CMA_MIN_ALIGNMENT_BYTES as alignment requirement which
+ * needs pageblock_order to be initialized. Let's enforce it.
+ */
+ if (!pageblock_order) {
+ pr_err("pageblock_order not yet initialized. Called during early boot?\n");
+ return -EINVAL;
+ }
+
/* ensure minimal alignment required by mm core */
if (!IS_ALIGNED(base | size, CMA_MIN_ALIGNMENT_BYTES))
return -EINVAL;
_
Patches currently in -mm which might be from ritesh.list@gmail.com are
reply other threads:[~2024-11-15 6:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241115065007.4CB2AC4CECF@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=david@redhat.com \
--cc=mm-commits@vger.kernel.org \
--cc=ritesh.list@gmail.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.