This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Fix for SSP error in tools/python/lowlevel/xc/xc.c

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Fix for SSP error in tools/python/lowlevel/xc/xc.c
From: Milan Holzäpfel <listen@xxxxxxxx>
Date: Wed, 26 Aug 2009 16:19:54 +0200
Cc: mail@xxxxxxxx
Delivery-date: Wed, 26 Aug 2009 07:20:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: mjh.name
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

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

(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;
>      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.
(<URL:http://docs.python.org/c-api/arg.html>)  This error is detected
by SSP as stack overflow. 

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. 

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). 

Milan Holzäpfel

Milan Holzaepfel <mail(a)mjh(d)name>             <URL:http://mjh.name/>
pub  4096R/C790FC23  EB8E 5E81 81E3 53A9 9B74  B895 5179 54C0 C790 FC23

Attachment: xen-3.4.1_fix_ssp_error.diff
Description: Text Data

Attachment: pgpUbFyMVflld.pgp
Description: PGP signature

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>