mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 14:43:58 +08:00
07708c4af1
So far unprivileged guest callers running in ring 3 can issue, e.g., MMU hypercalls. Normally, such callers cannot provide any hand-crafted MMU command structure as it has to be passed by its physical address, but they can still crash the guest kernel by passing random addresses. To close the hole, this patch considers hypercalls valid only if issued from guest ring 0. This may still be relaxed on a per-hypercall base in the future once required. Cc: stable@kernel.org Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
42 lines
858 B
C
42 lines
858 B
C
#ifndef __LINUX_KVM_PARA_H
|
|
#define __LINUX_KVM_PARA_H
|
|
|
|
/*
|
|
* This header file provides a method for making a hypercall to the host
|
|
* Architectures should define:
|
|
* - kvm_hypercall0, kvm_hypercall1...
|
|
* - kvm_arch_para_features
|
|
* - kvm_para_available
|
|
*/
|
|
|
|
/* Return values for hypercalls */
|
|
#define KVM_ENOSYS 1000
|
|
#define KVM_EFAULT EFAULT
|
|
#define KVM_E2BIG E2BIG
|
|
#define KVM_EPERM EPERM
|
|
|
|
#define KVM_HC_VAPIC_POLL_IRQ 1
|
|
#define KVM_HC_MMU_OP 2
|
|
|
|
/*
|
|
* hypercalls use architecture specific
|
|
*/
|
|
#include <asm/kvm_para.h>
|
|
|
|
#ifdef __KERNEL__
|
|
#ifdef CONFIG_KVM_GUEST
|
|
void __init kvm_guest_init(void);
|
|
#else
|
|
#define kvm_guest_init() do { } while (0)
|
|
#endif
|
|
|
|
static inline int kvm_para_has_feature(unsigned int feature)
|
|
{
|
|
if (kvm_arch_para_features() & (1UL << feature))
|
|
return 1;
|
|
return 0;
|
|
}
|
|
#endif /* __KERNEL__ */
|
|
#endif /* __LINUX_KVM_PARA_H */
|
|
|