From: Milan =?ISO-8859-1?Q?Holz=E4pfel?= Subject: Fix for SSP error in tools/python/lowlevel/xc/xc.c Date: Wed, 26 Aug 2009 16:19:54 +0200 Message-ID: <20090826161954.4ce96275.listen@mjh.name> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0175009469==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: mail@mjh.name List-Id: xen-devel@lists.xenproject.org --===============0175009469== Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Wed__26_Aug_2009_16_19_54_+0200_nLbbAytJy/48GUDh" --Signature=_Wed__26_Aug_2009_16_19_54_+0200_nLbbAytJy/48GUDh Content-Type: multipart/mixed; boundary="Multipart=_Wed__26_Aug_2009_16_19_54_+0200_NMiBFyeo42xW.g3_" --Multipart=_Wed__26_Aug_2009_16_19_54_+0200_NMiBFyeo42xW.g3_ Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello,=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 (this is the change which fixes it:) > @@ -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; 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 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 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 Regards, Milan Holz=E4pfel --=20 Milan Holzaepfel pub 4096R/C790FC23 EB8E 5E81 81E3 53A9 9B74 B895 5179 54C0 C790 FC23 --Multipart=_Wed__26_Aug_2009_16_19_54_+0200_NMiBFyeo42xW.g3_ Content-Type: text/x-patch; name="xen-3.4.1_fix_ssp_error.diff" Content-Disposition: attachment; filename="xen-3.4.1_fix_ssp_error.diff" Content-Transfer-Encoding: quoted-printable 2009-08-26 Milan Holzaepfel As documented on , the "i" format string needs an integer as target. Error detected by gentoo Stack Smashing Protection for gcc-4.3.3. --- xen-3.4.1/tools/python/xen/lowlevel/xc/xc.c.orig 2009-08-26 13:43:13.00= 0000000 +0000 +++ xen-3.4.1/tools/python/xen/lowlevel/xc/xc.c 2009-08-26 13:43:20.0000000= 00 +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; --Multipart=_Wed__26_Aug_2009_16_19_54_+0200_NMiBFyeo42xW.g3_-- --Signature=_Wed__26_Aug_2009_16_19_54_+0200_nLbbAytJy/48GUDh Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (GNU/Linux) iQIcBAEBAgAGBQJKlUSPAAoJECS5zg5RbO7vUcoQAIMGA8bCiFBu1A3HvC64e/Jm V4Ptp0lUvPtt4IEqgBoT47IFPLDbighgB5n49eASvalnjhU4I/73wQwGBgluP/h1 TW4UnWpnA1F5oplsCelwYFyRJD8TA+OuL4K9lz4yJTng226ulCegZllhPhinlaEV i3ApaHU5pr2iFXrH7I9nIf1EYMfQ+buimXbkpreviIbYZhWieHoSjFZmuOPl2WMe PjOleudGmSUC7GuuXv8DvAJnmff5gyO90aCp1i6Ew/Myv+xJPJuS7eUIbbvbY4wV piVAc7OpebSrewLVT2KCVFoGRPEINklmDfy9702OEE+gN13pHitt8SROyt2aetwk btYn2PxbqJBUY5QzarErSoP+BSYCsQXBYPda2fBTLoVpw/t5Y4jirSZXPSYUStFq xBiHtDMMHbAPbaZ/i981XKX0OPfegt6ywPH5P/pelayAnFNabV8QGRLvWlA5Eu2R LqYBzGs8qXopk0G8M/HoLsTfA0SLdXVZrndP/ckxL+Osx26TCphCLQdL1lLH7qi3 H0W8qzElUq+zwfHhq/G9fzWDlfZouAHZ/kn5VPQRPDGmnS1ZaqrDMtYl42o5wcn6 ych/nNB1NeGG/GjWlnpmwUgs32R9TsSarQWLvc+8HThdC892Q0AiMR1Ig4wC1Uwn NsgxhHZGuE4CPYTTBHO9 =hDxI -----END PGP SIGNATURE----- --Signature=_Wed__26_Aug_2009_16_19_54_+0200_nLbbAytJy/48GUDh-- --===============0175009469== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0175009469==--