[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools/libxl: Fix leaking ssid_label in libxl_name_to_domid



On Mon, Jan 28, 2019 at 05:57:04PM -0700, Tamas K Lengyel wrote:
> On Mon, Jan 28, 2019 at 5:16 AM Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
> >
> > On Sat, Jan 26, 2019 at 10:45:07PM -0700, Tamas K Lengyel wrote:
> > > On systems with XSM enabled libxl_name_to_domid leaks memory
> > > allocated for ssid_label:
> > >
> > > ==2693== 53 bytes in 2 blocks are definitely lost in loss record 4 of 8
> > > ==2693==    at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
> > > ==2693==    by 0x6C0A3B9: strdup (strdup.c:42)
> > > ==2693==    by 0x5108294: libxl_flask_sid_to_context (libxl_flask.c:39)
> > > ==2693==    by 0x50C2B64: libxl__xcinfo2xlinfo (libxl_domain.c:267)
> > > ==2693==    by 0x50C2E02: libxl_list_domain (libxl_domain.c:308)
> > > ==2693==    by 0x508A3C5: libxl_name_to_domid (libxl_utils.c:77)
> > >
> > > Signed-off-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
> > > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > > Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> > > ---
> > >  tools/libxl/libxl_utils.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
> > > index e50e094c48..99abfa5497 100644
> > > --- a/tools/libxl/libxl_utils.c
> > > +++ b/tools/libxl/libxl_utils.c
> > > @@ -79,6 +79,8 @@ int libxl_name_to_domid(libxl_ctx *ctx, const char 
> > > *name,
> > >          return ERROR_NOMEM;
> > >
> > >      for (i = 0; i < nb_domains; i++) {
> > > +        if (dominfo[i].ssid_label)
> > > +            free(dominfo[i].ssid_label);
> > >          domname = libxl_domid_to_name(ctx, dominfo[i].domid);
> > >          if (!domname)
> > >              continue;
> >
> > Thanks for reporting this issue. I think your patch isn't future-proof.
> >
> > Can you try the following patch?
> 
> Works too.

Thank you. I will add you reported-by and tested-by and submit this
patch properly.

Wei.

> 
> Thanks,
> Tamas

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.