x86/mem_event: validate the response vcpu_id before acting on it

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Tested-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
master commit: ee75480b3c
master date: 2014-07-23 18:07:11 +0200
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2014-07-28 15:06:09 +02:00
1 parent afb3cb30be
commit 60400ce54c
2 files changed
+30 -3

No files matched your search

+10 -1
View File
@@ -596,11 +596,20 @@ int mem_sharing_sharing_resume(struct domain *d)
/* Get all requests off the ring */
while ( mem_event_get_response(d, &d->mem_event->share, &rsp) )
{
struct vcpu *v;
if ( rsp.flags & MEM_EVENT_FLAG_DUMMY )
continue;
/* Validate the vcpu_id in the response. */
if ( (rsp.vcpu_id >= d->max_vcpus) || !d->vcpu[rsp.vcpu_id] )
continue;
v = d->vcpu[rsp.vcpu_id];
/* Unpause domain/vcpu */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
vcpu_unpause(v);
}
return 0;
+20 -2
View File
@@ -1226,8 +1226,17 @@ void p2m_mem_paging_resume(struct domain *d)
/* Pull all responses off the ring */
while( mem_event_get_response(d, &d->mem_event->paging, &rsp) )
{
struct vcpu *v;
if ( rsp.flags & MEM_EVENT_FLAG_DUMMY )
continue;
/* Validate the vcpu_id in the response. */
if ( (rsp.vcpu_id >= d->max_vcpus) || !d->vcpu[rsp.vcpu_id] )
continue;
v = d->vcpu[rsp.vcpu_id];
/* Fix p2m entry if the page was not dropped */
if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
{
@@ -1246,7 +1255,7 @@ void p2m_mem_paging_resume(struct domain *d)
}
/* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
vcpu_unpause(v);
}
}
@@ -1354,11 +1363,20 @@ void p2m_mem_access_resume(struct domain *d)
/* Pull all responses off the ring */
while( mem_event_get_response(d, &d->mem_event->access, &rsp) )
{
struct vcpu *v;
if ( rsp.flags & MEM_EVENT_FLAG_DUMMY )
continue;
/* Validate the vcpu_id in the response. */
if ( (rsp.vcpu_id >= d->max_vcpus) || !d->vcpu[rsp.vcpu_id] )
continue;
v = d->vcpu[rsp.vcpu_id];
/* Unpause domain */
if ( rsp.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
vcpu_unpause(d->vcpu[rsp.vcpu_id]);
vcpu_unpause(v);
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.