xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix stubdom build failure for RELEASE-4.3.1
@ 2013-10-31 14:44 Alex Sharp
  2013-10-31 14:57 ` Andrew Cooper
  2014-01-20 16:46 ` stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1) Ian Campbell
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Sharp @ 2013-10-31 14:44 UTC (permalink / raw)
  To: xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 2509 bytes --]

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.

diff --git a/extras/mini-os/fbfront.c b/extras/mini-os/fbfront.c
index 54a5e67..b6aaa6b 100644
--- a/extras/mini-os/fbfront.c
+++ b/extras/mini-os/fbfront.c
@@ -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;
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) {
                 printk("\"%s\" does not look like a PCI device address\n", s);
                 free(s);
                 continue;
diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c
index ee1691b..fa2e872 100644
--- a/extras/mini-os/xenbus/xenbus.c
+++ b/extras/mini-os/xenbus/xenbus.c
@@ -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;
 }


[-- Attachment #1.2: Type: text/html, Size: 4538 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1
  2013-10-31 14:44 [PATCH] Fix stubdom build failure for RELEASE-4.3.1 Alex Sharp
@ 2013-10-31 14:57 ` Andrew Cooper
  2013-10-31 18:00   ` Samuel Thibault
  2014-01-20 16:46 ` stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1) Ian Campbell
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cooper @ 2013-10-31 14:57 UTC (permalink / raw)
  To: Alex Sharp; +Cc: xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 3405 bytes --]

On 31/10/13 14:44, Alex Sharp wrote:
> 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.
>
> diff --git a/extras/mini-os/fbfront.c b/extras/mini-os/fbfront.c
> index 54a5e67..b6aaa6b 100644
> --- a/extras/mini-os/fbfront.c
> +++ b/extras/mini-os/fbfront.c
> @@ -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));

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".

>      if (err) {
>          message = "writing page-ref";
>          goto abort_transaction;
> 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) {

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

>                  printk("\"%s\" does not look like a PCI device
> address\n", s);
>                  free(s);
>                  continue;
> diff --git a/extras/mini-os/xenbus/xenbus.c
> b/extras/mini-os/xenbus/xenbus.c
> index ee1691b..fa2e872 100644
> --- a/extras/mini-os/xenbus/xenbus.c
> +++ b/extras/mini-os/xenbus/xenbus.c
> @@ -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

>      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);

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

>  
>      return ret;
>  }
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 7460 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1
  2013-10-31 14:57 ` Andrew Cooper
@ 2013-10-31 18:00   ` Samuel Thibault
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Thibault @ 2013-10-31 18:00 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Alex Sharp, xen-devel@lists.xen.org

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) {
> 
> 
> 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.

>     @@ -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

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

* stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1)
  2013-10-31 14:44 [PATCH] Fix stubdom build failure for RELEASE-4.3.1 Alex Sharp
  2013-10-31 14:57 ` Andrew Cooper
@ 2014-01-20 16:46 ` Ian Campbell
  2014-01-20 17:00   ` Processed: " xen
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2014-01-20 16:46 UTC (permalink / raw)
  To: xen-devel@lists.xen.org; +Cc: 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,
> 
> 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.

>  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.
> 
> diff --git a/extras/mini-os/fbfront.c b/extras/mini-os/fbfront.c
> index 54a5e67..b6aaa6b 100644
> --- a/extras/mini-os/fbfront.c
> +++ b/extras/mini-os/fbfront.c
> @@ -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;
> 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) {
>                  printk("\"%s\" does not look like a PCI device address\n", s);
>                  free(s);
>                  continue;
> diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c
> index ee1691b..fa2e872 100644
> --- a/extras/mini-os/xenbus/xenbus.c
> +++ b/extras/mini-os/xenbus/xenbus.c
> @@ -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
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Processed: stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1)
  2014-01-20 16:46 ` stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1) Ian Campbell
@ 2014-01-20 17:00   ` xen
  0 siblings, 0 replies; 5+ messages in thread
From: xen @ 2014-01-20 17:00 UTC (permalink / raw)
  To: Ian Campbell, xen-devel

Processing commands for xen@bugs.xenproject.org:

> create ^
Created new bug #35 rooted at `<A4D3962C02EE81408CC4341DF532AAC3364466@Exchange2.orionvm.com>'
Title: `stubdom build failure with gcc 4.8 (Was: Re: [Xen-devel] [PATCH] Fix stubdom build failure for RELEASE-4.3.1)'
> title it stubdom build failures with gcc 4.8
Set title for #35 to `stubdom build failures with gcc 4.8'
> 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 xen-bugs-owner@bugs.xenproject.org with any infrastructure issues

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

end of thread, other threads:[~2014-01-20 17:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 14:44 [PATCH] Fix stubdom build failure for RELEASE-4.3.1 Alex Sharp
2013-10-31 14:57 ` Andrew Cooper
2013-10-31 18:00   ` Samuel Thibault
2014-01-20 16:46 ` stubdom build failure with gcc 4.8 (Was: Re: [PATCH] Fix stubdom build failure for RELEASE-4.3.1) Ian Campbell
2014-01-20 17:00   ` Processed: " xen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).