Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
xen.2142
5672b726-x86-HVM-avoid-reading-ioreq-state-more...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5672b726-x86-HVM-avoid-reading-ioreq-state-more-than-once.patch of Package xen.2142
References: bsc#958523 XSA-166 # Commit b452430a4cdfc801fa4bc391aed7522365e1deb6 # Date 2015-12-17 14:22:46 +0100 # Author Jan Beulich <jbeulich@suse.com> # Committer Jan Beulich <jbeulich@suse.com> x86/HVM: avoid reading ioreq state more than once Otherwise, especially when the compiler chooses to translate the switch() to a jump table, unpredictable behavior (and in the jump table case arbitrary code execution) can result. This is XSA-166. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -400,23 +400,23 @@ bool_t hvm_io_pending(struct vcpu *v) static bool_t hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p) { + unsigned int state; + /* NB. Optimised for common case (p->state == STATE_IOREQ_NONE). */ - while ( p->state != STATE_IOREQ_NONE ) + while ( (state = p->state) != STATE_IOREQ_NONE ) { - switch ( p->state ) + rmb(); + switch ( state ) { case STATE_IORESP_READY: /* IORESP_READY -> NONE */ - rmb(); /* see IORESP_READY /then/ read contents of ioreq */ hvm_io_assist(p); break; case STATE_IOREQ_READY: /* IOREQ_{READY,INPROCESS} -> IORESP_READY */ case STATE_IOREQ_INPROCESS: - wait_on_xen_event_channel(sv->ioreq_evtchn, - (p->state != STATE_IOREQ_READY) && - (p->state != STATE_IOREQ_INPROCESS)); + wait_on_xen_event_channel(sv->ioreq_evtchn, p->state != state); break; default: - gdprintk(XENLOG_ERR, "Weird HVM iorequest state %d.\n", p->state); + gdprintk(XENLOG_ERR, "Weird HVM iorequest state %u\n", state); domain_crash(sv->vcpu->domain); return 0; /* bail */ }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor