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

Re: [Xen-devel] [PATCH, v2] linux-2.6.18: fix hypercall fallback code for very old hypervisors



>>> On 19.10.12 at 21:23, Konrad Rzeszutek Wilk <konrad@xxxxxxxxxx> wrote:
> On Tue, Oct 16, 2012 at 02:46:21PM +0100, Jan Beulich wrote:
>> While copying the argument structures in HYPERVISOR_event_channel_op()
>> and HYPERVISOR_physdev_op() into the local variable is sufficiently
>> safe even if the actual structure is smaller than the container one,
>> copying back eventual output values the same way isn't: This may
>> collide with on-stack variables (particularly "rc") which may change
>> between the first and second memcpy() (i.e. the second memcpy() could
>> discard that change).
>> 
>> Move the fallback code into out-of-line functions, and handle all of
>> the operations known by this old a hypervisor individually: Some don't
>> require copying back anything at all, and for the rest use the
>> individual argument structures' sizes rather than the container's.
>> 
>> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> v2: Reduce #define/#undef usage in HYPERVISOR_physdev_op_compat().
>> 
>> --- a/drivers/xen/core/Makefile
>> +++ b/drivers/xen/core/Makefile
>> @@ -2,7 +2,7 @@
>>  # Makefile for the linux kernel.
>>  #
>>  
>> -obj-y := evtchn.o gnttab.o features.o reboot.o machine_reboot.o
>> +obj-y := evtchn.o gnttab.o features.o reboot.o machine_reboot.o fallback.o
>>  
>>  obj-$(CONFIG_PCI)           += pci.o
>>  obj-$(CONFIG_XEN_PRIVILEGED_GUEST) += firmware.o
>> --- /dev/null
>> +++ b/drivers/xen/core/fallback.c
>> @@ -0,0 +1,84 @@
>> +#include <linux/kernel.h>
>> +#include <linux/string.h>
>> +#include <asm/bug.h>
>> +#include <asm/hypervisor.h>
>> +
>> +#if 1//temp CONFIG_XEN_COMPAT <= 0x030002
> 
> Um?

Spotted this left-over (from build testing) before committing,
luckily. Thanks for noticing nevertheless!

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.