[PATCH 2/3] Paravirtualization: Abstract sensitive instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rusty Russell wrote:
> Gruntwork, basically.  You'll see why it's paravirt.h and no_paravirt.h
> in the next patch.
>
> Name: Make Paravirtualization-requiring Instructions into Macros
> Status: Booted on 2.6.16-rc2-git7
> Depends: ring_assumptions_cleanup.patch.gz
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
>   

My only suggestion here is that sync_core be kept inline as a raw cpuid 
instruction rather than being moved into paravirt.h.  The purpose is not 
to extract CPUID information, but to serialize execution, and it can 
cause no trouble for a hypervisor, as cpuid doesn't trap anyway.  
Further, it is only used in the microcode update module, which isn't 
something that should be done in a hypervisor to begin with.

>  
> @@ -286,13 +269,6 @@ static inline void clear_in_cr4 (unsigne
>  	outb((data), 0x23); \
>  } while (0)
>  
> -/* Stop speculative execution */
> -static inline void sync_core(void)
> -{
> -	int tmp;
> -	asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
> -}

That said, there is an open "bug" on i386 in module loading.  We really 
should insert a call to sync_core during module loading after the 
alternative instructions have been patched.  In theory, the processor 
could prefetch the module code into the icache before any calls are made 
into the module, and since the module initialization calls follow 
shortly after the alternate patching, there is theoretically a window 
where the old code (albeit more conservative) could be executed.

Zach

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux