[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170725192049.133010186@linuxfoundation.org>
Date: Tue, 25 Jul 2017 12:20:50 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Balbir Singh <bsingharora@...il.com>,
Michael Ellerman <mpe@...erman.id.au>
Subject: [PATCH 4.12 051/196] powerpc/mm/radix: Fix execute permissions for interrupt_vectors
4.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Balbir Singh <bsingharora@...il.com>
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")
Signed-off-by: Balbir Singh <bsingharora@...il.com>
[mpe: Combine with the existing check, rewrite change log]
Signed-off-by: Michael Ellerman <mpe@...erman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
arch/powerpc/mm/pgtable-radix.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -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;
Powered by blists - more mailing lists