Bug 1031343

Summary: xen fails to build with GCC 7
Product: [openSUSE] openSUSE Tumbleweed Reporter: Martin Liška <martin.liska>
Component: XenAssignee: Charles Arnold <carnold>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P2 - High CC: carnold, dimstar, forgotten_7645792743, martin.liska, meissner
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 1030236    
Attachments: osc build log file

Description Martin Liška 2017-03-28 12:42:45 UTC
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/xen/standard/x86_64

[   62s] xenlockprof.c: In function 'main':
[   62s] xenlockprof.c:100:53: error: '%s' directive writing up to 39 bytes into a region of size between 17 and 37 [-Werror=format-overflow=]
[   62s]              sprintf(name, "unknown type(%d) %d lock %s", data[j].type,
[   62s]                                                      ^~
[   62s] In file included from /usr/include/stdio.h:939:0,
[   62s]                  from /home/abuild/rpmbuild/BUILD/xen-4.8.0-testing/tools/misc/../../tools/libxc/include/xenctrl.h:33,
[   62s]                  from xenlockprof.c:13:
[   62s] /usr/include/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 24 and 83 bytes into a destination of size 60
[   62s]    return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
[   62s]           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   62s]        __bos (__s), __fmt, __va_arg_pack ());
[   62s]        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 2 Martin Liška 2017-04-25 07:51:47 UTC
Ok, currently there are couple of issues:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:C/xen/standard/x86_64

1) [   57s] xenstored_domain.c:937:32: error: increment of a boolean expression [-Werror=bool-operation]

fixed on trunk, needs to backport:

2cb1f77c0494538ede7e44896db70d9cdddbcd66

2) xenlockprof.c:100:53: error: '%s' directive writing up to 39 bytes into a region of size between 17 and 37 [-Werror=format-overflow=]

fixed on trunk, needs to backport:

f49fa658b53580cf2ad354d2bf1796766cc11222

3) drivers/net/igbvf/igbvf_vf.c:359:10: error: this statement may fall through [-Werror=implicit-fallthrough=]

That would need to disable the warning as done in:

https://www.mail-archive.com/ipxe-devel@lists.ipxe.org/msg05329.html

Can you please help me with that to fix the package?
Comment 3 Martin Liška 2017-05-02 08:09:33 UTC
Any update Charles on that?
Comment 4 Charles Arnold 2017-05-02 14:08:16 UTC
(In reply to Martin Liška from comment #3)
> Any update Charles on that?

I have submitted Xen version 4.9-rc3 to Factory (which was accepted).
This version contains the requested commits from comment #2. However,
I won't be surprised if there are more problems yet to be encountered.

I have been busy recently with security fixes. I will now go back and look
at what other issues still exist.
Comment 5 Martin Liška 2017-05-02 14:11:01 UTC
(In reply to Charles Arnold from comment #4)
> (In reply to Martin Liška from comment #3)
> > Any update Charles on that?
> 
> I have submitted Xen version 4.9-rc3 to Factory (which was accepted).
> This version contains the requested commits from comment #2. However,
> I won't be surprised if there are more problems yet to be encountered.


I've just talked to Scarabeus and he told me that you are busy at the moment.
Anyhow, that's for the submission, I've been testing that with --alternative-project=openSUSE:Factory:Staging:C.

> 
> I have been busy recently with security fixes. I will now go back and look
> at what other issues still exist.

Yep, there are some. I try to fix the simple ones and we'll see.
Comment 6 Martin Liška 2017-05-02 14:52:53 UTC
So with the 4.9.0 version, I see following issues:

1) xenpmd.c:90:36: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 19 [-Werror=format-truncation=]
     #define BATTERY_INFO_FILE_PATH "/tmp/battery/%s/info"
                                    ^
xenpmd.c:113:37: note: in expansion of macro 'BATTERY_INFO_FILE_PATH'
             snprintf(file_name, 32, BATTERY_INFO_FILE_PATH,
                                     ^~~~~~~~~~~~~~~~~~~~~~
xenpmd.c:113:13: note: 'snprintf' output between 19 and 274 bytes into a destination of size 32
             snprintf(file_name, 32, BATTERY_INFO_FILE_PATH,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      dir_entries->d_name);
                      ~~~~~~~~~~~~~~~~~~~~
xenpmd.c:91:37: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 19 [-Werror=format-truncation=]
     #define BATTERY_STATE_FILE_PATH "/tmp/battery/%s/state"
                                     ^
xenpmd.c:116:37: note: in expansion of macro 'BATTERY_STATE_FILE_PATH'
             snprintf(file_name, 32, BATTERY_STATE_FILE_PATH,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
xenpmd.c:116:13: note: 'snprintf' output between 20 and 275 bytes into a destination of size 32
             snprintf(file_name, 32, BATTERY_STATE_FILE_PATH,
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      dir_entries->d_name);
                      ~~~~~~~~~~~~~~~~~~~~

This is not fixed upstream and the buffer should be expanded.

2) ld -r -nostdlib -L/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/cross-root-i686/i686-xen-elf/lib  -m elf_i386 /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/arch/x86/x86_32.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os_app.o  /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/blkfront.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/tpmfront.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/events.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/fbfront.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/gntmap.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/gnttab.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/hypervisor.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/kernel.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lock.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/main.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mm.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/netfront.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/sched.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/ctype.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/math.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/printf.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/stack_chk_fail.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/string.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/sys.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/xmalloc.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/lib/xs.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/xenbus/xenbus.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/console/console.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/console/xencons_ring.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/console/xenbus.o -L/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/arch/x86 -lx86_32  -lc -o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os.o
objcopy -w -G xenos_* -G _start /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os.o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os.o
ld -nostdlib -L/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/cross-root-i686/i686-xen-elf/lib  -m elf_i386 -T /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/arch/x86/minios-x86_32.lds  /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os.o  -o /home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os
/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/mini-os-x86_32-grub/mini-os.o: In function `_strtoll_r':
/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/stubdom/newlib-x86_32/i686-xen-elf/newlib/libc/stdlib/../../../../../newlib-1.16.0/newlib/libc/stdlib/strtoll_r.c:110: undefined reference to `__udivmoddi4'

It's probably not a known issue. Problem is that we should link that with -lgcc that provides that symbol. As it's i386 target, we'll need to add gcc-32bit package.
Comment 7 Martin Liška 2017-05-02 15:33:13 UTC
GCC 6.x used to generate __umoddi3 and __udivdi3, now __udivmoddi4 is generated. The xen i386 test needs to link w/ libgcc.a, instead of the newlib.
Comment 8 Bernhard Wiedemann 2017-05-17 16:03:31 UTC
This is an autogenerated message for OBS integration:
This bug (1031343) was mentioned in
https://build.opensuse.org/request/show/495658 Factory / xen
Comment 9 Charles Arnold 2017-05-17 17:50:21 UTC
If this issue is seen building Xen,

Traceback (most recent call last):
  File "gentest.py", line 6, in <module> 
    import random 
  File "/usr/lib64/python2.7/random.py", line 885, in <module>
    _inst = Random()
  File "/usr/lib64/python2.7/random.py", line 97, in __init__
    self.seed(x)
  File "/usr/lib64/python2.7/random.py", line 113, in seed
    a = long(_hexlify(_urandom(2500)), 16)
OSError: [Errno 38] Function not implemented

It is caused by a change in glibc 2.24 which in turn has introduced
a bug in python.

See http://bugs.python.org/issue29188

A patch is attached to that python bug.
Comment 10 Dominique Leuenberger 2017-05-17 17:58:40 UTC
(In reply to Charles Arnold from comment #9)
> 
> It is caused by a change in glibc 2.24 which in turn has introduced
> a bug in python.

TW is already at glibc 2.25 - let's hope that fix is already available there
Comment 11 Bernhard Wiedemann 2017-05-17 18:00:26 UTC
This is an autogenerated message for OBS integration:
This bug (1031343) was mentioned in
https://build.opensuse.org/request/show/495685 Factory / xen
Comment 12 Martin Liška 2017-05-18 09:16:15 UTC
Created attachment 725531 [details]
osc build log file

Trying latest Virtualization/xen with --alternative-project=openSUSE:Factory:Staging:C and it finishes with an error.

Please take a look at attached log file, is it the python issue?
It uses glibc-2.25-4.5
Comment 13 Charles Arnold 2017-05-18 14:38:47 UTC
(In reply to Martin Liška from comment #12)
> Created attachment 725531 [details]
> osc build log file
> 
> Trying latest Virtualization/xen with
> --alternative-project=openSUSE:Factory:Staging:C and it finishes with an
> error.
> 
> Please take a look at attached log file, is it the python issue?
> It uses glibc-2.25-4.5

This is the "strtoll_r.c:110: undefined reference to `__udivmoddi4'"
problem you mentioned in comment #7.
Comment 14 Bernhard Wiedemann 2017-05-19 06:01:22 UTC
This is an autogenerated message for OBS integration:
This bug (1031343) was mentioned in
https://build.opensuse.org/request/show/496467 Factory / xen
Comment 15 Martin Liška 2017-05-19 07:45:12 UTC
(In reply to Charles Arnold from comment #13)
> (In reply to Martin Liška from comment #12)
> > Created attachment 725531 [details]
> > osc build log file
> > 
> > Trying latest Virtualization/xen with
> > --alternative-project=openSUSE:Factory:Staging:C and it finishes with an
> > error.
> > 
> > Please take a look at attached log file, is it the python issue?
> > It uses glibc-2.25-4.5
> 
> This is the "strtoll_r.c:110: undefined reference to `__udivmoddi4'"
> problem you mentioned in comment #7.

I see. I can confirm that I can currently build xen with latest Staging:C gcc7 compiler. Good job!
Comment 16 Charles Arnold 2017-05-25 22:10:45 UTC
I believe we can close this now.