diff mbox

tools/libxl: Fix a segment fault when mmio_hole is set in hvm.cfg

Message ID 1499911419-10410-1-git-send-email-xiong.y.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhang, Xiong Y July 13, 2017, 2:03 a.m. UTC
When valid mmio_hole is set in hvm.cfg, segment fault happens at accessing
localents pointer.

Because the size of localents pointer isn't enough to store appended
mmio_hole_size parameter.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 tools/libxl/libxl_create.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu July 12, 2017, 10:15 a.m. UTC | #1
On Thu, Jul 13, 2017 at 10:03:39AM +0800, Xiong Zhang wrote:
> When valid mmio_hole is set in hvm.cfg, segment fault happens at accessing
> localents pointer.
> 
> Because the size of localents pointer isn't enough to store appended
> mmio_hole_size parameter.
> 
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>

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

Ian please backport this.
Christopher Clark Aug. 2, 2017, 7:32 p.m. UTC | #2
On Wed, Jul 12, 2017 at 3:15 AM, Wei Liu <wei.liu2@citrix.com> wrote:
>
> On Thu, Jul 13, 2017 at 10:03:39AM +0800, Xiong Zhang wrote:
> > When valid mmio_hole is set in hvm.cfg, segment fault happens at accessing
> > localents pointer.
> >
> > Because the size of localents pointer isn't enough to store appended
> > mmio_hole_size parameter.
> >
> > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> > ---
> >
> >     tools/libxl/libxl_create.c | 2 +-
> >     1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >    diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> >    index bffbc45..1158303 100644
> >    --- a/tools/libxl/libxl_create.c
> >    +++ b/tools/libxl/libxl_create.c
> >    @@ -451,7 +451,7 @@ int libxl__domain_build(libxl__gc *gc,
> >             vments[4] = "start_time";
> >             vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
> >
> >    -        localents = libxl__calloc(gc, 9, sizeof(char *));
> >    +        localents = libxl__calloc(gc, 11, sizeof(char *));
> >             i = 0;
> >             localents[i++] = "platform/acpi";
> >             localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0";
>
>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> Ian please backport this.


Bump: the above patch still needs to be backported into 4.9 please.

master commit: 614a14736e33fb84872eb00f08799ebbc73a96c6

thanks,

Christopher
--
http://openxt.org/
Wei Liu Aug. 4, 2017, 4:07 p.m. UTC | #3
On Wed, Aug 02, 2017 at 12:32:58PM -0700, Christopher Clark wrote:
> On Wed, Jul 12, 2017 at 3:15 AM, Wei Liu <wei.liu2@citrix.com> wrote:
> >
> > On Thu, Jul 13, 2017 at 10:03:39AM +0800, Xiong Zhang wrote:
> > > When valid mmio_hole is set in hvm.cfg, segment fault happens at accessing
> > > localents pointer.
> > >
> > > Because the size of localents pointer isn't enough to store appended
> > > mmio_hole_size parameter.
> > >
> > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> > > ---
> > >
> > >     tools/libxl/libxl_create.c | 2 +-
> > >     1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > >    diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> > >    index bffbc45..1158303 100644
> > >    --- a/tools/libxl/libxl_create.c
> > >    +++ b/tools/libxl/libxl_create.c
> > >    @@ -451,7 +451,7 @@ int libxl__domain_build(libxl__gc *gc,
> > >             vments[4] = "start_time";
> > >             vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
> > >
> > >    -        localents = libxl__calloc(gc, 9, sizeof(char *));
> > >    +        localents = libxl__calloc(gc, 11, sizeof(char *));
> > >             i = 0;
> > >             localents[i++] = "platform/acpi";
> > >             localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0";
> >
> >
> > Acked-by: Wei Liu <wei.liu2@citrix.com>
> >
> > Ian please backport this.
> 
> 
> Bump: the above patch still needs to be backported into 4.9 please.
> 
> master commit: 614a14736e33fb84872eb00f08799ebbc73a96c6

In Ian's absence I have cherry-picked this to 4.9 branch. Older branches
don't need this patch.
diff mbox

Patch

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index bffbc45..1158303 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -451,7 +451,7 @@  int libxl__domain_build(libxl__gc *gc,
         vments[4] = "start_time";
         vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
 
-        localents = libxl__calloc(gc, 9, sizeof(char *));
+        localents = libxl__calloc(gc, 11, sizeof(char *));
         i = 0;
         localents[i++] = "platform/acpi";
         localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0";