From: "Ashish Bijlani" Subject: Re: do_iret bug in xen Date: Tue, 27 Nov 2007 14:28:20 -0500 Message-ID: References: <1196191008.4632.6.camel@thinkpad.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0232934794==" Return-path: In-Reply-To: <1196191008.4632.6.camel@thinkpad.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel Stodden Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0232934794== Content-Type: multipart/alternative; boundary="----=_Part_1260_33458418.1196191700248" ------=_Part_1260_33458418.1196191700248 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline since "sti" is on, an interrupt can occur which can cause the control to enter "__runq_tickle", which then invokes "cpumask_raise_softirq(mask, SCHEDULE_SOFTIRQ)" to send IPI to a processor causing the control to enter "__enter_scheduler" which changes the current. On Nov 27, 2007 2:16 PM, Daniel Stodden wrote: > > On Tue, 2007-11-27 at 13:59 -0500, Ashish Bijlani wrote: > > "do_iret" (slow iret via hyercall) can introduce a race condition as > > "current" can change during the execution of the function. all > > hypercalls run with "sti" on, so an interrupt on a processor causing > > the control to enter in "__enter_scheduler" after reading current can > > change the current process on that processor. > > follow the code e.g. surounding ret_from_intr. __enter_scheduler is a > softirq handler. it will only be run upon return to guest context, not > when returning to an interrupted hypervisor. xen is not preemptible. > > regards, > daniel > > -- > Daniel Stodden > LRR - Lehrstuhl f=FCr Rechnertechnik und Rechnerorganisation > Institut f=FCr Informatik der TU M=FCnchen D-85748 Garching > http://www.lrr.in.tum.de/~stodden > mailto:stodden@cs.tum.edu > PGP Fingerprint: F5A4 1575 4C56 E26A 0B33 3D80 457E 82AE B0D8 735B > > > ------=_Part_1260_33458418.1196191700248 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline since "sti" is on, an interrupt can occur which can cause the con= trol to enter "__runq_tickle", which then invokes "cpumask_r= aise_softirq(mask, SCHEDULE_SOFTIRQ)" to send IPI to a processor causi= ng the control to enter "__enter_scheduler" which changes the cur= rent.

On Nov 27, 2007 2:16 PM, Daniel Stodden = <stodden@cs.tum.edu> wrote:=

On Tue, 2007-11-27 at 13:59 -0500, Ashish Bijlani= wrote:
> "do_iret" (slow iret via hyercall) can introduce = a race condition as
> "current" can change during the execu= tion of the function. all
> hypercalls run with "sti" on, so an interrupt on a proce= ssor causing
> the control to enter in "__enter_scheduler" = after reading current can
> change the current process on that proces= sor.

follow the code e.g. surounding ret_from_intr. __enter_schedu= ler is a
softirq handler. it will only be run upon return to guest conte= xt, not
when returning to an interrupted hypervisor. xen is not preempti= ble.

regards,
daniel

--
Daniel Stod= den
LRR     -      Lehrstuhl f=FCr Rechnertechn= ik und Rechnerorganisation
Institut f=FCr Informatik der TU M=FCnchen &n= bsp;           D-85748 Garching
http://ww= w.lrr.in.tum.de/~stodden         mailto:stodden@cs.tum.edu
PGP Fingerprint: F5A4 = 1575 4C56 E26A 0B33  3D80 457E 82AE B0D8 735B



------=_Part_1260_33458418.1196191700248-- --===============0232934794== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0232934794==--