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>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user