All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: "Milan Holzäpfel" <listen@mjh.name>
Cc: mail@mjh.name, xen-devel@lists.xensource.com
Subject: Re: Fix for SSP error in tools/python/lowlevel/xc/xc.c
Date: Wed, 26 Aug 2009 13:39:31 -0400	[thread overview]
Message-ID: <20090826173931.GA15189@phenom.dumpdata.com> (raw)
In-Reply-To: <20090826161954.4ce96275.listen@mjh.name>

On Wed, Aug 26, 2009 at 04:19:54PM +0200, Milan Holzäpfel wrote:
> Hello, 
> 
> 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: 
> 
> (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;

I would say use uint32_t instead of int.

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

What about the two other cases where domid_it is used? The SSP didn't
detect them?
> 
> 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. 

Yeah, but running more than 64K of guests on one node?

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

> 	2009-08-26 Milan Holzaepfel <mail@mjh.name>
> 
> 	As documented on <URL:http://docs.python.org/c-api/arg.html>, 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.000000000 +0000
> +++ xen-3.4.1/tools/python/xen/lowlevel/xc/xc.c	2009-08-26 13:43:20.000000000 +0000
> @@ -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;




> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

  reply	other threads:[~2009-08-26 17:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 14:19 Fix for SSP error in tools/python/lowlevel/xc/xc.c Milan Holzäpfel
2009-08-26 17:39 ` Konrad Rzeszutek Wilk [this message]
2009-08-27  8:36   ` Milan Holzäpfel
2009-08-27 12:23     ` Konrad Rzeszutek Wilk
2009-08-27 16:27       ` Milan Holzäpfel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090826173931.GA15189@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=listen@mjh.name \
    --cc=mail@mjh.name \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.