1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Sanity-check the vm exitcode, and exit the process if it's out-of-bounds

or there is no registered handler.

Submitted by:	Bela Lubkin   bela dot lubkin at tidalscale dot com
This commit is contained in:
Peter Grehan 2013-07-18 18:40:54 +00:00
parent c158e13f7d
commit 8b271170d1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253452

View File

@ -509,6 +509,7 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
{
cpuset_t mask;
int error, rc, prevcpu;
enum vm_exitcode exitcode;
if (guest_vcpu_mux)
setup_timeslice();
@ -538,8 +539,16 @@ vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
}
prevcpu = vcpu;
rc = (*handler[vmexit[vcpu].exitcode])(ctx, &vmexit[vcpu],
&vcpu);
exitcode = vmexit[vcpu].exitcode;
if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) {
fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n",
exitcode);
exit(1);
}
rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu);
switch (rc) {
case VMEXIT_SWITCH:
assert(guest_vcpu_mux);