summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/sections.h
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-04-29 12:17:26 +0200
committerAlexander Graf <agraf@suse.de>2014-04-29 12:36:09 +0200
commitb18db0b80867931f4e3a844400a3c22a4fd2ff57 (patch)
tree0bc2511f1c513a919904016a0665949107f36c40 /arch/powerpc/include/asm/sections.h
parentKVM: PPC: Book3S: ifdef on CONFIG_KVM_BOOK3S_32_HANDLER for 32bit (diff)
downloadlinux-b18db0b80867931f4e3a844400a3c22a4fd2ff57.tar.xz
linux-b18db0b80867931f4e3a844400a3c22a4fd2ff57.zip
KVM guest: Make pv trampoline code executable
Our PV guest patching code assembles chunks of instructions on the fly when it encounters more complicated instructions to hijack. These instructions need to live in a section that we don't mark as non-executable, as otherwise we fault when jumping there. Right now we put it into the .bss section where it automatically gets marked as non-executable. Add a check to the NX setting function to ensure that we leave these particular pages executable. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/include/asm/sections.h')
-rw-r--r--arch/powerpc/include/asm/sections.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index d0e784e0ff48..521790330672 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -39,6 +39,17 @@ static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
(unsigned long)_stext < end;
}
+static inline int overlaps_kvm_tmp(unsigned long start, unsigned long end)
+{
+#ifdef CONFIG_KVM_GUEST
+ extern char kvm_tmp[];
+ return start < (unsigned long)kvm_tmp &&
+ (unsigned long)&kvm_tmp[1024 * 1024] < end;
+#else
+ return 0;
+#endif
+}
+
#undef dereference_function_descriptor
static inline void *dereference_function_descriptor(void *ptr)
{