From: Michael Ellerman <mpe@ellerman.id.au>
To: linuxppc-dev@ozlabs.org
Cc: aneesh.kumar@linux.vnet.ibm.com
Subject: [PATCH 3/6] powerpc/mm/radix: Fix small page at boundary when splitting
Date: Fri, 19 Oct 2018 15:13:31 +1100 [thread overview]
Message-ID: <20181019041334.4945-3-mpe@ellerman.id.au> (raw)
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>
When we have CONFIG_STRICT_KERNEL_RWX enabled, we want to split the
linear mapping at the text/data boundary so we can map the kernel
text read only.
Currently we always use a small page at the text/data boundary, even
when that's not necessary:
Mapped 0x0000000000000000-0x0000000000e00000 with 2.00 MiB pages
Mapped 0x0000000000e00000-0x0000000001000000 with 64.0 KiB pages
Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
This is because the check that the mapping crosses the __init_begin
boundary is too strict, it also returns true when we map exactly up to
the boundary.
So fix it to check that the mapping would actually map past
__init_begin, and with that we see:
Mapped 0x0000000000000000-0x0000000040000000 with 2.00 MiB pages
Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index bb85c58b96c8..7a44ec276290 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -295,14 +295,14 @@ static int __meminit create_physical_mapping(unsigned long start,
if (split_text_mapping && (mapping_size == PUD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) >= __pa_symbol(__init_begin)) {
+ (addr + mapping_size) > __pa_symbol(__init_begin)) {
max_mapping_size = PMD_SIZE;
goto retry;
}
if (split_text_mapping && (mapping_size == PMD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) >= __pa_symbol(__init_begin)) {
+ (addr + mapping_size) > __pa_symbol(__init_begin)) {
mapping_size = PAGE_SIZE;
psize = mmu_virtual_psize;
}
--
2.17.2
next prev parent reply other threads:[~2018-10-19 4:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 4:13 [PATCH 1/6] powerpc/mm/radix: Fix off-by-one in split mapping logic Michael Ellerman
2018-10-19 4:13 ` [PATCH 2/6] powerpc/mm/radix: Fix overuse of small pages in splitting logic Michael Ellerman
2018-10-19 4:13 ` Michael Ellerman [this message]
2018-10-19 4:13 ` [PATCH 4/6] powerpc/mm/radix: Remove the retry in the split mapping logic Michael Ellerman
2018-10-19 4:13 ` [PATCH 5/6] powerpc/mm/radix: Simplify " Michael Ellerman
2018-10-19 4:13 ` [PATCH 6/6] powerpc/mm/radix: Display if mappings are exec or not Michael Ellerman
2018-10-22 9:39 ` [1/6] powerpc/mm/radix: Fix off-by-one in split mapping logic Michael Ellerman
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=20181019041334.4945-3-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/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 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).