Skip to contentSkip to conversation

xen: patch to fix ARM libxc missing variable init

PATCH In review [email protected] 2 participants 2 messages Sep 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: patch to fix ARM libxc missing variable init

From: Christopher Clark <[email protected]>

Fix Xen 4.9.0 build error on ARM architecture with gcc 7:
Import upstream Xen patch 88bfbf90e35f1213f9967a97dee0b2039f9998a4

Error was:
xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used uninitialized in this function [-Werror=maybe-uninitialized]

---

This patch has been requested for inclusion in the upstream 4.9 branch and later Xen 4.9 releases.

Please use my gmail address for any correspondence.

 ...x-libxc-xc_dom_arm-missing-initialization.patch | 36 ++++++++++++++++++++++
 recipes-extended/xen/xen_4.9.0.bb                  |  2 ++
 2 files changed, 38 insertions(+)
 create mode 100644 recipes-extended/xen/files/fix-libxc-xc_dom_arm-missing-initialization.patch
recipes-extended/xen/files/fix-libxc-xc_dom_arm-missing-initialization.patch new file +36 -0
new file mode 100644
index 0000000..05016a7
@@ -0,0 +1,36 @@
+commit 88bfbf90e35f1213f9967a97dee0b2039f9998a4
+Author: Bernd Kuhls <[email protected]>
+Date:   Sat Aug 19 16:21:42 2017 +0200
+
+    tools/libxc/xc_dom_arm: add missing variable initialization
+    
+    The variable domctl.u.address_size.size may remain uninitialized if
+    guest_type is not one of xen-3.0-aarch64 or xen-3.0-armv7l. And the
+    code precisely checks if this variable is still 0 to decide if the
+    guest type is supported or not.
+    
+    This fixes the following build failure with gcc 7.x:
+    
+    xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+         if ( domctl.u.address_size.size == 0 )
+    
+    Patch originally taken from
+    https://www.mail-archive.com/[email protected]/msg109313.html.
+    
+    Signed-off-by: Bernd Kuhls <[email protected]>
+    Signed-off-by: Thomas Petazzoni <[email protected]>
+    Acked-by: Wei Liu <[email protected]>
+
+diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
+index e7d4bd0..e669fb0 100644
+--- a/tools/libxc/xc_dom_arm.c
++++ b/tools/libxc/xc_dom_arm.c
+@@ -223,6 +223,8 @@ static int set_mode(xc_interface *xch, domid_t domid, char *guest_type)
+ 
+     domctl.domain = domid;
+     domctl.cmd    = XEN_DOMCTL_set_address_size;
++    domctl.u.address_size.size = 0;
++
+     for ( i = 0; i < ARRAY_SIZE(types); i++ )
+         if ( !strcmp(types[i].guest, guest_type) )
+             domctl.u.address_size.size = types[i].size;
recipes-extended/xen/xen_4.9.0.bb +2 -0
index 0b20936..8e9c802 100644
@@ -1,7 +1,9 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 require xen.inc
 
 SRC_URI = " \
     https://downloads.xenproject.org/release/xen/${PV}/xen-${PV}.tar.gz \
+    file://fix-libxc-xc_dom_arm-missing-initialization.patch \
     "
 
 SRC_URI[md5sum] = "f0a753637630f982dfbdb64121fd71e1"
Signature · 1 line
2.7.4
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Sun, Sep 17, 2017 at 6:22 PM, <[email protected]> wrote:

From: Christopher Clark <[email protected]>

Fix Xen 4.9.0 build error on ARM architecture with gcc 7:
Import upstream Xen patch 88bfbf90e35f1213f9967a97dee0b2039f9998a4

Error was:
xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Thanks,
Alistair

Quoted 71 lines

---

This patch has been requested for inclusion in the upstream 4.9 branch and later Xen 4.9 releases.

Please use my gmail address for any correspondence.

 ...x-libxc-xc_dom_arm-missing-initialization.patch | 36 ++++++++++++++++++++++
 recipes-extended/xen/xen_4.9.0.bb                  |  2 ++
 2 files changed, 38 insertions(+)
 create mode 100644 recipes-extended/xen/files/fix-libxc-xc_dom_arm-missing-initialization.patch
recipes-extended/xen/files/fix-libxc-xc_dom_arm-missing-initialization.patch new file +36 -0
new file mode 100644
index 0000000..05016a7
@@ -0,0 +1,36 @@
+commit 88bfbf90e35f1213f9967a97dee0b2039f9998a4
+Author: Bernd Kuhls <[email protected]>
+Date:   Sat Aug 19 16:21:42 2017 +0200
+
+    tools/libxc/xc_dom_arm: add missing variable initialization
+
+    The variable domctl.u.address_size.size may remain uninitialized if
+    guest_type is not one of xen-3.0-aarch64 or xen-3.0-armv7l. And the
+    code precisely checks if this variable is still 0 to decide if the
+    guest type is supported or not.
+
+    This fixes the following build failure with gcc 7.x:
+
+    xc_dom_arm.c:229:31: error: 'domctl.u.address_size.size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+         if ( domctl.u.address_size.size == 0 )
+
+    Patch originally taken from
+    https://www.mail-archive.com/[email protected]/msg109313.html.
+
+    Signed-off-by: Bernd Kuhls <[email protected]>
+    Signed-off-by: Thomas Petazzoni <[email protected]>
+    Acked-by: Wei Liu <[email protected]>
+
+diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
+index e7d4bd0..e669fb0 100644
+--- a/tools/libxc/xc_dom_arm.c
++++ b/tools/libxc/xc_dom_arm.c
+@@ -223,6 +223,8 @@ static int set_mode(xc_interface *xch, domid_t domid, char *guest_type)
+
+     domctl.domain = domid;
+     domctl.cmd    = XEN_DOMCTL_set_address_size;
++    domctl.u.address_size.size = 0;
++
+     for ( i = 0; i < ARRAY_SIZE(types); i++ )
+         if ( !strcmp(types[i].guest, guest_type) )
+             domctl.u.address_size.size = types[i].size;
recipes-extended/xen/xen_4.9.0.bb +2 -1
index 0b20936..8e9c802 100644
@@ -1,7 +1,9 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 require xen.inc
 
 SRC_URI = " \
     https://downloads.xenproject.org/release/xen/${PV}/xen-${PV}.tar.gz \
+    file://fix-libxc-xc_dom_arm-missing-initialization.patch \
     "
 
 SRC_URI[md5sum] = "f0a753637630f982dfbdb64121fd71e1"
--

2.7.4