Skip to content

Commit f505f33

Browse files
JasonChenCJlijinxia
authored andcommitted
hypercall: only allow hypercall from RING-0
only allow hypercall from RING-0 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent d219140 commit f505f33

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

hypervisor/arch/x86/guest/vmcall.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ int vmcall_vmexit_handler(struct vcpu *vcpu)
5252
/* hypercall param4 from guest, reserved*/
5353
/* uint64_t param4 = cur_context->guest_cpu_regs.regs.rcx; */
5454

55+
if (!is_hypercall_from_ring0()) {
56+
pr_err("hypercall is only allowed from RING-0!\n");
57+
return -1;
58+
}
59+
5560
/* Dispatch the hypercall handler */
5661
switch (hypcall_id) {
5762
case HC_GET_API_VERSION:

hypervisor/common/trusty_hypercall.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ int64_t hcall_world_switch(struct vcpu *vcpu)
4040
{
4141
int next_world_id = !(vcpu->arch_vcpu.cur_context);
4242

43-
if (!is_hypercall_from_ring0()) {
44-
pr_err("%s() is only allowed from RING-0!\n", __func__);
45-
return -1;
46-
}
47-
4843
if (!vcpu->vm->sworld_control.sworld_enabled) {
4944
pr_err("Secure World is not enabled!\n");
5045
return -1;
@@ -64,11 +59,6 @@ int64_t hcall_world_switch(struct vcpu *vcpu)
6459

6560
int64_t hcall_initialize_trusty(struct vcpu *vcpu, uint64_t param)
6661
{
67-
if (!is_hypercall_from_ring0()) {
68-
pr_err("%s() is only allowed from RING-0!\n", __func__);
69-
return -1;
70-
}
71-
7262
if (!vcpu->vm->sworld_control.sworld_enabled) {
7363
pr_err("Secure World is not enabled!\n");
7464
return -1;

0 commit comments

Comments
 (0)