[PATCH 2/3] powerpc/mm/hash: WARN if relocation is enabled and CONFIG_STRICT_KERNEL_RWX

Balbir Singh bsingharora at gmail.com
Wed Jul 5 17:14:24 AEST 2017


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 at 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



More information about the Linuxppc-dev mailing list