From: "Jan Beulich" Subject: Re: [PATCH, v2] linux-2.6.18: fix hypercall fallback code for very old hypervisors Date: Mon, 22 Oct 2012 07:47:24 +0100 Message-ID: <5085081C02000078000A2DCC@nat28.tlf.novell.com> References: <507D6F3D02000078000A1B13@nat28.tlf.novell.com> <507D814D02000078000A1B51@nat28.tlf.novell.com> <20121019192300.GA20513@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20121019192300.GA20513@phenom.dumpdata.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: Ian Campbell , Dan Carpenter , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 19.10.12 at 21:23, Konrad Rzeszutek Wilk 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 >> Signed-off-by: Jan Beulich >> --- >> 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 >> +#include >> +#include >> +#include >> + >> +#if 1//temp CONFIG_XEN_COMPAT <= 0x030002 > > Um? Spotted this left-over (from build testing) before committing, luckily. Thanks for noticing nevertheless! Jan