Skip to contentSkip to conversation

Fix stubdom build failure for RELEASE-4.3.1

PATCH In review Alex Sharp 5 participants 5 messages Oct 31, 2013 – Jan 20, 2014

lore
Share & tools
lore

Alex Sharp

author
#0 lore raw

PATCH 1/1 Fix stubdom build failure for RELEASE-4.3.1

Hey,

I noticed that RELEASE-4.3.1 (commit 4e8e0bdef96859e6f428af74be6f4a3bc7fd11f3) was failing to make stubdom, complaining of various forms of format string mismatch. The following patch at least gets things to compile, but I'm not sure if there's a deeper underlying issue. I'm using gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) on x86_64. My .config contains the line "PYTHON_PREFIX_ARG=--install-layout=deb" and I'm ./configuring with --prefix=

Hope this helps.

extras/mini-os/fbfront.c +2 -2
index 54a5e67..b6aaa6b 100644
@@ -105,7 +105,7 @@ again:
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "page-ref","%u", virt_to_mfn(s));
+    err = xenbus_printf(xbt, nodename, "page-ref","%lu", virt_to_mfn(s));
     if (err) {
         message = "writing page-ref";
         goto abort_transaction;
@@ -463,7 +463,7 @@ again:
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "page-ref","%u", virt_to_mfn(s));
+    err = xenbus_printf(xbt, nodename, "page-ref","%lu", virt_to_mfn(s));
     if (err) {
         message = "writing page-ref";
         goto abort_transaction;
extras/mini-os/pcifront.c +1 -1
index bbe21e0..9d0cb17 100644
@@ -413,7 +413,7 @@ int pcifront_physical_to_virtual (struct pcifront_dev *dev,
                 continue;
             }
 
-            if (sscanf(s, "%x:%x:%x.%x", dom, bus, slot, fun) != 4) {
+            if (sscanf(s, "%x:%x:%x.%lx", dom, bus, slot, fun) != 4) {
                 printk("\"%s\" does not look like a PCI device address\n", s);
                 free(s);
                 continue;
extras/mini-os/xenbus/xenbus.c +2 -2
index ee1691b..fa2e872 100644
@@ -672,7 +672,7 @@ char *xenbus_transaction_start(xenbus_transaction_t *xbt)
     err = errmsg(rep);
     if (err)
        return err;
-    sscanf((char *)(rep + 1), "%u", xbt);
+    sscanf((char *)(rep + 1), "%lu", xbt);
     free(rep);
     return NULL;
 }
@@ -769,7 +769,7 @@ domid_t xenbus_get_self_id(void)
     domid_t ret;
 
     BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
-    sscanf(dom_id, "%d", &ret);
+    sscanf(dom_id, "%u", (unsigned int*)&ret);
 
     return ret;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 27 lines · Alex Sharp

Hey,

I noticed that RELEASE-4.3.1 (commit 4e8e0bdef96859e6f428af74be6f4a3bc7fd11f3) was failing to make stubdom, complaining of various forms of format string mismatch. The following patch at least gets things to compile, but I'm not sure if there's a deeper underlying issue. I'm using gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) on x86_64. My .config contains the line "PYTHON_PREFIX_ARG=--install-layout=deb" and I'm ./configuring with --prefix=

Hope this helps.

extras/mini-os/fbfront.c +1 -1
index 54a5e67..b6aaa6b 100644
@@ -105,7 +105,7 @@ again:
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "page-ref","%u", virt_to_mfn(s));
+    err = xenbus_printf(xbt, nodename, "page-ref","%lu", virt_to_mfn(s));
     if (err) {
         message = "writing page-ref";
         goto abort_transaction;

extras/mini-os/fbfront.c again: · line 466

Quoted 5 lines
extras/mini-os/fbfront.c +1 -1
@@ -463,7 +463,7 @@ again:
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "page-ref","%u", virt_to_mfn(s));
+    err = xenbus_printf(xbt, nodename, "page-ref","%lu", virt_to_mfn(s));

The two above here are certainly valid. virt_to_mfn() goes through many macros and ends up reading out of "unsigned long *phys_to_machine_mapping".

Quoted 8 lines
extras/mini-os/fbfront.c +0 -0
     if (err) {
         message = "writing page-ref";
         goto abort_transaction;
extras/mini-os/pcifront.c +0 -0
index bbe21e0..9d0cb17 100644

extras/mini-os/pcifront.c int pcifront_physical_to_virtual (struct · line 417

Quoted 6 lines
extras/mini-os/pcifront.c +1 -1
@@ -413,7 +413,7 @@ int pcifront_physical_to_virtual (struct
 pcifront_dev *dev,
                 continue;
             }
 
-            if (sscanf(s, "%x:%x:%x.%x", dom, bus, slot, fun) != 4) {
+            if (sscanf(s, "%x:%x:%x.%lx", dom, bus, slot, fun) != 4) {

This is a little awkward. It has been changed in unstable and is now correct. Perhaps a subset of the change needs backporting

Quoted 10 lines
extras/mini-os/pcifront.c +0 -0
                 printk("\"%s\" does not look like a PCI device
 address\n", s);
                 free(s);
                 continue;
extras/mini-os/xenbus/xenbus.c +0 -0
index ee1691b..fa2e872 100644

extras/mini-os/xenbus/xenbus.c char · line 676

Quoted 6 lines
extras/mini-os/xenbus/xenbus.c +1 -1
@@ -672,7 +672,7 @@ char
 *xenbus_transaction_start(xenbus_transaction_t *xbt)
     err = errmsg(rep);
     if (err)
        return err;
-    sscanf((char *)(rep + 1), "%u", xbt);
+    sscanf((char *)(rep + 1), "%lu", xbt);

This is good

extras/mini-os/xenbus/xenbus.c domid_t xenbus_get_self_id(void) · line 772

Quoted 9 lines
extras/mini-os/xenbus/xenbus.c +0 -0
     free(rep);
     return NULL;

}

extras/mini-os/xenbus/xenbus.c +1 -1
@@ -769,7 +769,7 @@ domid_t xenbus_get_self_id(void)
     domid_t ret;
 
     BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
-    sscanf(dom_id, "%d", &ret);
+    sscanf(dom_id, "%u", (unsigned int*)&ret);

This needs to be

sscanf(dom_id, "%"SCNd16, &ret);

That pointer casting there will result in stack corruption.

Could you please follow the instructions
http://wiki.xen.org/wiki/Submitting_Xen_Patches (specifically the Signed-off-by line) and submit a patch against xen-unstable, which can then be backported appropriately.

~Andrew

Quoted 10 lines
extras/mini-os/xenbus/xenbus.c +0 -0
     return ret;
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 13 lines · Andrew Cooper, le Thu 31 Oct 2013 14:57:24 +0000, a écrit :
    diff --git a/extras/mini-os/pcifront.c b/extras/mini-os/pcifront.c
    index bbe21e0..9d0cb17 100644
    --- a/extras/mini-os/pcifront.c
    +++ b/extras/mini-os/pcifront.c
    @@ -413,7 +413,7 @@ int pcifront_physical_to_virtual (struct pcifront_dev
    *dev,
                     continue;
                 }
     
    -            if (sscanf(s, "%x:%x:%x.%x", dom, bus, slot, fun) != 4) {
    +            if (sscanf(s, "%x:%x:%x.%lx", dom, bus, slot, fun) != 4) {
Quoted 1 line

This is a little awkward. It has been changed in unstable and is now correct.

Mmm, I don't see it fixed in unstable. I wonder why fun is an unsigned long at all, it is even passed unsigned ints in callers. pcifront_physical_to_virtual and pcifront_conf_read should just use unsigned int.

Quoted 11 lines
    @@ -769,7 +769,7 @@ domid_t xenbus_get_self_id(void)
         domid_t ret;
     
         BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
    -    sscanf(dom_id, "%d", &ret);
    +    sscanf(dom_id, "%u", (unsigned int*)&ret);

This needs to be

sscanf(dom_id, "%"SCNd16, &ret);

Mmm, perhaps rather make ret itself an unsigned int? I'd rather not hardcode here what a domid_t is.

I agree on the rest.

Samuel

#3 lore raw

stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1)

In reply to Alex Sharp

create ^
title it stubdom build failures with gcc 4.8
thanks

On Thu, 2013-10-31 at 14:44 +0000, Alex Sharp wrote:
Hey,

Quoted 3 lines

I noticed that RELEASE-4.3.1 (commit 4e8e0bdef96859e6f428af74be6f4a3bc7fd11f3) was failing to make stubdom, complaining of various forms of format string mismatch.

User "concave" reported on #xentest during the test day yesterday that this issue affects 4.4-rc2 as well.

There were a couple of minor comments, which should appear in the bug log once it is create (or search the archives).

Assuming Alex isn't able to resubmit are there any devs with a suitable distro who'd like to take a run at it?

Ian.

Quoted 71 lines

The following patch at least gets things to compile, but I'm not sure
if there's a deeper underlying issue. I'm using gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) on x86_64. My .config contains the line "PYTHON_PREFIX_ARG=--install-layout=deb" and I'm ./configuring with --prefix=

Hope this helps.

extras/mini-os/fbfront.c +2 -2
index 54a5e67..b6aaa6b 100644
@@ -105,7 +105,7 @@ again:
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "page-ref","%u", virt_to_mfn(s));
+    err = xenbus_printf(xbt, nodename, "page-ref","%lu", virt_to_mfn(s));
     if (err) {
         message = "writing page-ref";
         goto abort_transaction;
@@ -463,7 +463,7 @@ again:
         free(err);
     }
 
-    err = xenbus_printf(xbt, nodename, "page-ref","%u", virt_to_mfn(s));
+    err = xenbus_printf(xbt, nodename, "page-ref","%lu", virt_to_mfn(s));
     if (err) {
         message = "writing page-ref";
         goto abort_transaction;
extras/mini-os/pcifront.c +1 -1
index bbe21e0..9d0cb17 100644
@@ -413,7 +413,7 @@ int pcifront_physical_to_virtual (struct pcifront_dev *dev,
                 continue;
             }
 
-            if (sscanf(s, "%x:%x:%x.%x", dom, bus, slot, fun) != 4) {
+            if (sscanf(s, "%x:%x:%x.%lx", dom, bus, slot, fun) != 4) {
                 printk("\"%s\" does not look like a PCI device address\n", s);
                 free(s);
                 continue;
extras/mini-os/xenbus/xenbus.c +2 -2
index ee1691b..fa2e872 100644
@@ -672,7 +672,7 @@ char *xenbus_transaction_start(xenbus_transaction_t *xbt)
     err = errmsg(rep);
     if (err)
        return err;
-    sscanf((char *)(rep + 1), "%u", xbt);
+    sscanf((char *)(rep + 1), "%lu", xbt);
     free(rep);
     return NULL;
 }
@@ -769,7 +769,7 @@ domid_t xenbus_get_self_id(void)
     domid_t ret;
 
     BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
-    sscanf(dom_id, "%d", &ret);
+    sscanf(dom_id, "%u", (unsigned int*)&ret);
 
     return ret;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw

Processed: stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1)

Processing commands for [email protected]:

Quoted 1 line

create ^

Created new bug #35 rooted at `<[email protected]>'
Title: `stubdom build failure with gcc 4.8 (Was: Re: [Xen-devel] [PATCH] Fix stubdom build failure for RELEASE-4.3.1)'

Quoted 1 line

title it stubdom build failures with gcc 4.8

Set title for #35 to `stubdom build failures with gcc 4.8'

Quoted 1 line

thanks

Finished processing.

Modified/created Bugs:
- 35: http://bugs.xenproject.org/xen/bug/35 (new)

---
Xen Hypervisor Bug Tracker
See http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen for information on reporting bugs Contact [email protected] with any infrastructure issues