Skip to contentSkip to conversation

Patch "powerpc/mm/radix: Fix execute permissions for interrupt_vectors" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Jul 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

powerpc/mm/radix: Fix execute permissions for interrupt_vectors

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
powerpc-mm-radix-fix-execute-permissions-for-interrupt_vectors.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 7f6d498ed3354740cfd100e4aa99e388f1a95be7 Mon Sep 17 00:00:00 2001

From: Balbir Singh <[email protected]>
Date: Thu, 29 Jun 2017 03:04:10 +1000
Subject: powerpc/mm/radix: Fix execute permissions for interrupt_vectors

From: Balbir Singh <[email protected]>

commit 7f6d498ed3354740cfd100e4aa99e388f1a95be7 upstream.

Commit 9abcc981de97 ("powerpc/mm/radix: Only add X for pages overlapping kernel text") changed the linear mapping on Radix to only mark the kernel text executable.

However if the kernel is run relocated, for example as a kdump kernel, then the exception vectors are split from the kernel text, ie. they remain at real address 0.

We tend to get away with it, because the kernel itself will usually be below 1G, which means the 1G page at 0-1G is marked executable and everything works OK. However if the kernel is loaded above 1G, or the system has less than 1G in total (meaning we can't use a 1G page), then the exception vectors will not be marked executable and the kernel will fail to boot.

Fix it by also checking if the address range overlaps the exception vectors when deciding if we should add PAGE_KERNEL_X.

Fixes 9abcc981de97 ("powerpc/mm/radix: Only add X for pages overlapping kernel text")
[mpe: Combine with the existing check, rewrite change log]
---
 arch/powerpc/mm/pgtable-radix.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/mm/pgtable-radix.c +2 -1
@@ -149,7 +149,8 @@ static int __meminit create_physical_map
 
 		vaddr = (unsigned long)__va(addr);
 
-		if (overlaps_kernel_text(vaddr, vaddr + mapping_size))
+		if (overlaps_kernel_text(vaddr, vaddr + mapping_size) ||
+		    overlaps_interrupt_vector_text(vaddr, vaddr + mapping_size))
 			prot = PAGE_KERNEL_X;
 		else
 			prot = PAGE_KERNEL;

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/powerpc-mm-radix-only-add-x-for-pages-overlapping-kernel-text.patch queue-4.12/powerpc-pseries-fix-passing-of-pp0-in-updatepp-and-updateboltedpp.patch queue-4.12/powerpc-mm-radix-fix-execute-permissions-for-interrupt_vectors.patch