From: Konrad Rzeszutek Wilk Subject: Re: Fix for SSP error in tools/python/lowlevel/xc/xc.c Date: Wed, 26 Aug 2009 13:39:31 -0400 Message-ID: <20090826173931.GA15189@phenom.dumpdata.com> References: <20090826161954.4ce96275.listen@mjh.name> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <20090826161954.4ce96275.listen@mjh.name> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Milan =?iso-8859-1?Q?Holz=E4pfel?= Cc: mail@mjh.name, xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Wed, Aug 26, 2009 at 04:19:54PM +0200, Milan Holz=E4pfel wrote: > Hello,=20 >=20 > I compiled xen-tools with GCC-4.3.3 with Stack Smashing Protection > (SSP) patches by gentoo, and found a small bug in > tools/python/lowlevel/xc/xc.c. The bug is located in > pyxc_dom_set_policy_cpuid:=20 >=20 > (this is the change which fixes it:) >=20 > > @@ -808,7 +808,7 @@ > > static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self, > > PyObject *args) > > { > > - domid_t domid; > > + int domid; I would say use uint32_t instead of int. > > =20 > > if ( !PyArg_ParseTuple(args, "i", &domid) ) > > return NULL; >=20 > domid_t is defined as uint16_t (thus 2 bytes long) in xen header files, > but the "i" format needs a C "int" type, which is 4 bytes long. > () This error is detected > by SSP as stack overflow.=20 What about the two other cases where domid_it is used? The SSP didn't detect them? >=20 > Attached patch fixes the error. Maybe it would better to use "h" > format instead of the "i" format, which converts the argument to an C > "short int". Then you would have to change the python wrapper if > domid_t changes, though.=20 Yeah, but running more than 64K of guests on one node? >=20 > Please apply this patch or the change to the "h" format string (I > haven't tested it, but I believe it should work just as well).=20 >=20 > Regards, > Milan Holz=E4pfel >=20 >=20 > --=20 > Milan Holzaepfel > pub 4096R/C790FC23 EB8E 5E81 81E3 53A9 9B74 B895 5179 54C0 C790 FC23 > 2009-08-26 Milan Holzaepfel >=20 > As documented on , the "i" > format string needs an integer as target. >=20 > Error detected by gentoo Stack Smashing Protection for gcc-4.3.3. >=20 > --- xen-3.4.1/tools/python/xen/lowlevel/xc/xc.c.orig 2009-08-26 13:43:1= 3.000000000 +0000 > +++ xen-3.4.1/tools/python/xen/lowlevel/xc/xc.c 2009-08-26 13:43:20.000= 000000 +0000 > @@ -808,7 +808,7 @@ > static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self, > PyObject *args) > { > - domid_t domid; > + int domid; > =20 > if ( !PyArg_ParseTuple(args, "i", &domid) ) > return NULL; > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel