Subject: Re: Fix for spllower()
To: None <port-xen@NetBSD.org>
From: Mathieu Ropert <mro@adviseo.fr>
List: port-xen
Date: 05/03/2006 12:36:40
My bad, missed the patched read/write PSL functions :(

Manuel Bouyer wrote:

>On Wed, May 03, 2006 at 11:44:52AM +0200, Mathieu Ropert wrote:
>  
>
>>Hi,
>>
>>I've noticed a potential bug in the spllower() implementation for Xen:
>>the original code saves flags through read_psl(), disable interrupts 
>>('cli' on x86) and then even run Xspllower() (if pending interrupts) or 
>>set new level and restore flags (with write_psl()).
>>On x86, saving and restoring EFLAGS includes restoring the 'IF' flag (if 
>>it was previously set) cleared by disable_intr(), thus reenabling 
>>interrupts.
>>As the 'IF' flag isn't virtualized on Xen, we may end spllower() without 
>>reenabling interrupts.
>>    
>>
>
>On Xen, read_psl() and write_psl() don't change the EFLAGS register, but
>read or write the evtchn_upcall_mask shared variable (see include/cpufunc.h).
>So the write_psl() call will really reenable interrupts if needed. I can't
>see a problem here.
>
>
>  
>