xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxc: Fix Segmentation fault of xend
@ 2010-06-19  6:23 Yu Zhiguo
  2010-06-21 14:03 ` Ian Jackson
  0 siblings, 1 reply; 7+ messages in thread
From: Yu Zhiguo @ 2010-06-19  6:23 UTC (permalink / raw)
  To: Keir Fraser, xen-devel@lists.xensource.com

If /proc/xen/privcmd cannot be opened,
start xend occurs Segmentation fault.
Add check to fix it.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>

diff -r b9c541d9c138 -r 659e4b69d26b tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c	Tue Jun 15 13:27:14 2010 +0100
+++ b/tools/libxc/xc_private.c	Sat Jun 19 22:24:09 2010 +0800
@@ -82,8 +82,10 @@
 
 void xc_clear_last_error(xc_interface *xch)
 {
-    xch->last_error.code = XC_ERROR_NONE;
-    xch->last_error.message[0] = '\0';
+    if (xch) {
+        xch->last_error.code = XC_ERROR_NONE;
+        xch->last_error.message[0] = '\0';
+    }
 }
 
 const char *xc_error_code_to_desc(int code)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libxc: Fix Segmentation fault of xend
  2010-06-19  6:23 [PATCH] libxc: Fix Segmentation fault of xend Yu Zhiguo
@ 2010-06-21 14:03 ` Ian Jackson
  2010-06-21 14:03   ` Ian Jackson
  2010-06-22  0:58   ` [PATCH] lowlevel: " Yu Zhiguo
  0 siblings, 2 replies; 7+ messages in thread
From: Ian Jackson @ 2010-06-21 14:03 UTC (permalink / raw)
  To: Yu Zhiguo; +Cc: xen-devel@lists.xensource.com, Keir Fraser

Yu Zhiguo writes ("[Xen-devel] [PATCH] libxc: Fix Segmentation fault of xend"):
> If /proc/xen/privcmd cannot be opened,
> start xend occurs Segmentation fault.
> Add check to fix it.

This change is not correct.

>  void xc_clear_last_error(xc_interface *xch)
...
> -    xch->last_error.message[0] = '\0';
> +    if (xch) {

It is wrong to call xc_clear_last_error with a NULL xc_interface*.
If xend is doing this it is probably a bug in the python xc lowlevel
interface.  Can you get a stack trace please so that we can fix the
call site ?

Nacked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libxc: Fix Segmentation fault of xend
  2010-06-21 14:03 ` Ian Jackson
@ 2010-06-21 14:03   ` Ian Jackson
  2010-06-21 14:06     ` Keir Fraser
  2010-06-22  0:58   ` [PATCH] lowlevel: " Yu Zhiguo
  1 sibling, 1 reply; 7+ messages in thread
From: Ian Jackson @ 2010-06-21 14:03 UTC (permalink / raw)
  To: Yu Zhiguo, Keir Fraser, xen-devel@lists.xensource.com

I wrote:
> Nacked-by: Ian Jackson <ian.jackson@eu.citrix.com>

I see that, unfortunately, this patch has already been applied.

Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libxc: Fix Segmentation fault of xend
  2010-06-21 14:03   ` Ian Jackson
@ 2010-06-21 14:06     ` Keir Fraser
  2010-06-21 14:11       ` Ian Jackson
  0 siblings, 1 reply; 7+ messages in thread
From: Keir Fraser @ 2010-06-21 14:06 UTC (permalink / raw)
  To: Ian Jackson, Yu Zhiguo, xen-devel@lists.xensource.com

On 21/06/2010 15:03, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:

> I wrote:
>> Nacked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> I see that, unfortunately, this patch has already been applied.

I can revert it.

 -- Keir

> Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] libxc: Fix Segmentation fault of xend
  2010-06-21 14:06     ` Keir Fraser
@ 2010-06-21 14:11       ` Ian Jackson
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2010-06-21 14:11 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel@lists.xensource.com, Yu Zhiguo

Keir Fraser writes ("Re: [Xen-devel] [PATCH] libxc: Fix Segmentation fault of xend"):
> On 21/06/2010 15:03, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:
> > I wrote:
> >> Nacked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > 
> > I see that, unfortunately, this patch has already been applied.
> 
> I can revert it.

Thanks, I think that would be best.

Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lowlevel: Fix Segmentation fault of xend
  2010-06-21 14:03 ` Ian Jackson
  2010-06-21 14:03   ` Ian Jackson
@ 2010-06-22  0:58   ` Yu Zhiguo
  2010-06-22 14:58     ` Ian Jackson
  1 sibling, 1 reply; 7+ messages in thread
From: Yu Zhiguo @ 2010-06-22  0:58 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel@lists.xensource.com, Keir Fraser

Hi Ian,

Ian Jackson wrote:
> 
> It is wrong to call xc_clear_last_error with a NULL xc_interface*.
> If xend is doing this it is probably a bug in the python xc lowlevel
> interface.  Can you get a stack trace please so that we can fix the
> call site ?
> 


The stack trace is
 PyXc_init()
  -> pyxc_error_to_exception(0)
   -> xc_clear_last_error()

So fix it in pyxc_error_to_exception(). Thanks for your reply.

V2 is following.

-----------------

If /proc/xen/privcmd cannot be opened,
start xend occurs Segmentation fault.
Add check to fix it.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>

diff -r 72c6228b5f0f -r bd3bf925f4ce tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c	Mon Jun 21 19:19:25 2010 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c	Tue Jun 22 17:02:30 2010 +0800
@@ -72,7 +72,8 @@
     else
         pyerr = Py_BuildValue("(is)", err->code, desc);
 
-    xc_clear_last_error(xch);
+    if (xch)
+        xc_clear_last_error(xch);
 
     if ( pyerr != NULL )
     {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] lowlevel: Fix Segmentation fault of xend
  2010-06-22  0:58   ` [PATCH] lowlevel: " Yu Zhiguo
@ 2010-06-22 14:58     ` Ian Jackson
  0 siblings, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2010-06-22 14:58 UTC (permalink / raw)
  To: Yu Zhiguo; +Cc: Keir, xen-devel@lists.xensource.com, Fraser

Yu Zhiguo writes ("Re: [Xen-devel] [PATCH] lowlevel: Fix Segmentation fault of xend"):
> The stack trace is
>  PyXc_init()
>   -> pyxc_error_to_exception(0)
>    -> xc_clear_last_error()
> 
> So fix it in pyxc_error_to_exception(). Thanks for your reply.

That's great, thanks.

Ian.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-22 14:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-19  6:23 [PATCH] libxc: Fix Segmentation fault of xend Yu Zhiguo
2010-06-21 14:03 ` Ian Jackson
2010-06-21 14:03   ` Ian Jackson
2010-06-21 14:06     ` Keir Fraser
2010-06-21 14:11       ` Ian Jackson
2010-06-22  0:58   ` [PATCH] lowlevel: " Yu Zhiguo
2010-06-22 14:58     ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).