libxc: Fix Segmentation fault of xend
PATCH 1/1 libxc: Fix Segmentation fault of xend
If /proc/xen/privcmd cannot be opened,
start xend occurs Segmentation fault.
Add check to fix it.
tools/libxc/xc_private.c +4 -2
@@ -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)
Yu Zhiguo writes ("[Xen-devel] [PATCH] libxc: Fix Segmentation fault of xend"):
Quoted 3 lines
If
/proc/xen/privcmdcannot be opened,
start xend occurs Segmentation fault.
Add check to fix it.
This change is not correct.
Quoted 1 line
void
xc_clear_last_error(xc_interface *xch)
...
tools/libxc/xc_private.c line 85
Quoted 2 lines
tools/libxc/xc_private.c +1
-1- 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 ?
Ian.
Quoted 1 line · I wrote:
Nacked-by Ian Jackson <[email protected]>
I see that, unfortunately, this patch has already been applied.
Ian.
Quoted 4 lines · Ian Jackson
Quoted 1 line · I wrote:
Nacked-by Ian Jackson <[email protected]>I see that, unfortunately, this patch has already been applied.
I can revert it.
-- Keir
Quoted 1 line
Ian.
Keir Fraser writes ("Re: [Xen-devel] [PATCH] libxc: Fix Segmentation fault of xend"):
Quoted 7 lines · Ian Jackson
Quoted 4 lines
Quoted 1 line · I wrote:
Nacked-by Ian Jackson <[email protected]>I see that, unfortunately, this patch has already been applied.
I can revert it.
Thanks, I think that would be best.
Ian.
Re: [PATCH] lowlevel: Fix Segmentation fault of xend
In reply to Ian JacksonHi Ian,
Quoted 6 lines · Ian Jackson
It is wrong to call
xc_clear_last_errorwith 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.
tools/python/xen/lowlevel/xc/xc.c +2 -1
@@ -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 ) {
Re: [PATCH] lowlevel: Fix Segmentation fault of xend
Yu Zhiguo writes ("Re: [Xen-devel] [PATCH] lowlevel: Fix Segmentation fault of xend"):
Quoted 6 lines
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.