linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <bsingharora@gmail.com>
To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au
Subject: [PATCH 2/3] powerpc/mm/hash: WARN if relocation is enabled and CONFIG_STRICT_KERNEL_RWX
Date: Wed,  5 Jul 2017 17:14:24 +1000	[thread overview]
Message-ID: <20170705071425.5417-3-bsingharora@gmail.com> (raw)
In-Reply-To: <20170705071425.5417-1-bsingharora@gmail.com>

For radix we split the mapping into smaller page sizes (at the cost of
additional TLB overhead), but for hash its best to print a warning. In
the case of hash and no-relocation, the kernel should be well aligned
to provide the least overhead with the current linear mapping size (16M)

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
 arch/powerpc/mm/pgtable-hash64.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/pgtable-hash64.c b/arch/powerpc/mm/pgtable-hash64.c
index 0809102b..7c2479d 100644
--- a/arch/powerpc/mm/pgtable-hash64.c
+++ b/arch/powerpc/mm/pgtable-hash64.c
@@ -438,6 +438,11 @@ void hash__mark_rodata_ro(void)
 		return;
 	}
 
+	if (PHYSICAL_START > MEMORY_START)
+		pr_warn("Detected relocation and CONFIG_STRICT_KERNEL_RWX "
+			"permissions are best effort, some non-text area "
+			"might still be left as executable");
+
 	shift = mmu_psize_defs[mmu_linear_psize].shift;
 	step = 1 << shift;
 
@@ -448,7 +453,7 @@ void hash__mark_rodata_ro(void)
 			start, end, step);
 
 	if (start == end) {
-		pr_warn("could not set rodata ro, relocate the start"
+		pr_warn("Could not set rodata ro, relocate the start"
 			" of the kernel to a 0x%x boundary\n", step);
 		return;
 	}
-- 
2.9.4

  parent reply	other threads:[~2017-07-05  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05  7:14 [PATCH 0/3] Have CONFIG_STRICT_KERNEL_RWX work with CONFIG_RELOCATABLE Balbir Singh
2017-07-05  7:14 ` [PATCH 1/3] powerpc/mm/radix: Fix relocatable radix mappings for STRICT_RWX Balbir Singh
2017-07-05  7:14 ` Balbir Singh [this message]
2017-07-05  7:14 ` [PATCH 3/3] powerpc/strict_kernel_rwx: Don't depend on !RELOCATABLE Balbir Singh

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=20170705071425.5417-3-bsingharora@gmail.com \
    --to=bsingharora@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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).