/bugzilla3/ Bug 1186 – xen ia64 build failure using gcc-4.3
Bug 1186 - xen ia64 build failure using gcc-4.3
: xen ia64 build failure using gcc-4.3
Status: RESOLVED FIXED
Product: Xen
Tools
: unstable
: IA64 Linux
: P2 normal
Assigned To: Xen Bug List
:
:
:
  Show dependency treegraph
 
Reported: 2008-03-05 15:12 CST by Doug Chapman
Modified: 2008-03-10 15:42 CDT (History)
0 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Chapman 2008-03-05 15:12:54 CST
This fails to build under gcc-4.3 but looking at the code it might have been
causing some sort of strange problems before even when it did build since it is
writing off the end of an array.

Since Fedora has moved to gcc-4.3 this prevents building this under
Fedora-ia64.  Also, other tools have dependencies on the xen tools so there are
other key things in fedora that break on ia64 because of this.

cc1: warnings being treated as errors
ia64/xc_ia64_stubs.c: In function 'xc_ia64_p2m_map':
ia64/xc_ia64_stubs.c:95: error: array subscript is above array bounds


The type privcmd_hypercall_t is defined as:
typedef struct privcmd_hypercall
{
        __u64 op;
        __u64 arg[5];
} privcmd_hypercall_t;


but we write 6 items (with the 6th being a zero):

    hypercall.op = __HYPERVISOR_ia64_dom0vp_op;
    hypercall.arg[0] = IA64_DOM0VP_expose_foreign_p2m;
    hypercall.arg[1] = (unsigned long)addr;
    hypercall.arg[2] = dom;
    hypercall.arg[3] = (unsigned long)memmap_info;
    hypercall.arg[4] = flags;
    hypercall.arg[5] = 0;
Comment 1 Doug Chapman 2008-03-05 15:14:27 CST
One other thing noted by Daniel Berrange at redhat:

The hypervisor impl of this hypercall doesn't even seem to want args 4 & 5

    case IA64_DOM0VP_expose_foreign_p2m: {
        XEN_GUEST_HANDLE(char) hnd;
        set_xen_guest_handle(hnd, (char*)arg2);
        ret = dom0vp_expose_foreign_p2m(d, arg0, (domid_t)arg1, hnd, arg3);
        break;
    }

So, its unclear why userspace is setting them
Comment 2 Isaku Yamahata 2008-03-10 02:47:00 CDT
The last arg isn't used, my bad. So could you try removing the line?

diff --git a/tools/libxc/ia64/xc_ia64_stubs.c
b/tools/libxc/ia64/xc_ia64_stubs.c
--- a/tools/libxc/ia64/xc_ia64_stubs.c
+++ b/tools/libxc/ia64/xc_ia64_stubs.c
@@ -92,7 +92,6 @@ xc_ia64_map_foreign_p2m(int xc_handle, u
     hypercall.arg[2] = dom;
     hypercall.arg[3] = (unsigned long)memmap_info;
     hypercall.arg[4] = flags;
-    hypercall.arg[5] = 0;

     if (lock_pages(memmap_info,
                    sizeof(*memmap_info) + memmap_info->efi_memmap_size) != 0)
{
Comment 3 Doug Chapman 2008-03-10 07:48:29 CDT
(In reply to comment #2)
> The last arg isn't used, my bad. So could you try removing the line?
> 
> 

Yes, this does allow it to compile cleanly.  I don't know if it works properly
since right now we cannot build the xen kernel for Fedora-ia64 but it does
build cleanly.
Comment 4 Alex Williamson 2008-03-10 15:42:51 CDT
Fixed in ia64/xen-unstable.hg cset 716a637722e4, expect this to be pulled into
main upstream tree soon.