All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] libxc: fix segfault on uninitialized xch->fmem
@ 2017-04-04 12:40 Seraphime Kirkovski
  2017-04-04 12:59 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Seraphime Kirkovski @ 2017-04-04 12:40 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Wei Liu, Seraphime Kirkovski

Currently in xc_interface_open, xch->fmem is not initialized
and in some rare case the code fails before ever assigning a value
to it.

I got this in master:

   $ sudo ./xl/xl run
   xencall: error: Could not obtain handle on privileged command interface: No such file or directory
   Segmentation fault

This initializes the whole xch_buff to 0.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
---

 Changes from v1:
   * Initialize the entire struct xc_interface_core to 0

 tools/libxc/xc_private.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 72e6242417..f395594a8f 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -30,7 +30,7 @@ struct xc_interface_core *xc_interface_open(xentoollog_logger *logger,
                                             xentoollog_logger *dombuild_logger,
                                             unsigned open_flags)
 {
-    struct xc_interface_core xch_buf, *xch = &xch_buf;
+    struct xc_interface_core xch_buf = { 0 }, *xch = &xch_buf;
 
     xch->flags = open_flags;
     xch->dombuild_logger_file = 0;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCHv2] libxc: fix segfault on uninitialized xch->fmem
  2017-04-04 12:40 [PATCHv2] libxc: fix segfault on uninitialized xch->fmem Seraphime Kirkovski
@ 2017-04-04 12:59 ` Wei Liu
  2017-04-05 15:13   ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2017-04-04 12:59 UTC (permalink / raw)
  To: Seraphime Kirkovski; +Cc: Ian Jackson, Wei Liu, xen-devel

On Tue, Apr 04, 2017 at 02:40:48PM +0200, Seraphime Kirkovski wrote:
> Currently in xc_interface_open, xch->fmem is not initialized
> and in some rare case the code fails before ever assigning a value
> to it.
> 
> I got this in master:
> 
>    $ sudo ./xl/xl run
>    xencall: error: Could not obtain handle on privileged command interface: No such file or directory
>    Segmentation fault
> 
> This initializes the whole xch_buff to 0.
> 
> Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCHv2] libxc: fix segfault on uninitialized xch->fmem
  2017-04-04 12:59 ` Wei Liu
@ 2017-04-05 15:13   ` Wei Liu
  2017-04-05 15:51     ` Ian Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2017-04-05 15:13 UTC (permalink / raw)
  To: Seraphime Kirkovski; +Cc: Ian Jackson, Wei Liu, xen-devel

On Tue, Apr 04, 2017 at 01:59:27PM +0100, Wei Liu wrote:
> On Tue, Apr 04, 2017 at 02:40:48PM +0200, Seraphime Kirkovski wrote:
> > Currently in xc_interface_open, xch->fmem is not initialized
> > and in some rare case the code fails before ever assigning a value
> > to it.
> > 
> > I got this in master:
> > 
> >    $ sudo ./xl/xl run
> >    xencall: error: Could not obtain handle on privileged command interface: No such file or directory
> >    Segmentation fault
> > 
> > This initializes the whole xch_buff to 0.
> > 
> > Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Ian, this is a backport candidate.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCHv2] libxc: fix segfault on uninitialized xch->fmem
  2017-04-05 15:13   ` Wei Liu
@ 2017-04-05 15:51     ` Ian Jackson
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2017-04-05 15:51 UTC (permalink / raw)
  To: Wei Liu; +Cc: Seraphime Kirkovski, xen-devel

Wei Liu writes ("Re: [PATCHv2] libxc: fix segfault on uninitialized xch->fmem"):
> Ian, this is a backport candidate.

Queued, thanks (until after 4.8.1, given that currently this is in
staging only).

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-04-05 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 12:40 [PATCHv2] libxc: fix segfault on uninitialized xch->fmem Seraphime Kirkovski
2017-04-04 12:59 ` Wei Liu
2017-04-05 15:13   ` Wei Liu
2017-04-05 15:51     ` Ian Jackson

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.