Skip to contentSkip to conversation

staging GCC 8.1.0 build warnings

DISCUSSION John Thomson 3 participants 4 messages May 9, 2018 – May 15, 2018

lore
Share & tools
lore
#0 lore raw

Hi,
Trying to build Xen staging with GCC 8.1.0 and facing some of the new warnings:

For OVMF, I used these three commits:
https://github.com/tianocore/edk2/compare/1d212a83df0eaf32a6f5d4159beb2d77832e0231^...9de306701312f986c9638cb819d3f1f848d55cab.patch
1d212a83df0eaf32a6f5d4159beb2d77832e0231
9222154ae7b3eef75ae88cdb56158256227cb929
9de306701312f986c9638cb819d3f1f848d55cab

For IPXE, one of these patches:
http://lists.ipxe.org/pipermail/ipxe-devel/2018-April/006146.html
https://build.opensuse.org/package/view_file/openSUSE:Factory/qemu/ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch?expand=1

I was still unable to build IPXE at the Xen selected commit in tools/firmware/etherboot/Makefile:IPXE_GIT_TAG, with Errors:
[BUILD] bin/netdevice.o
Assembler messages
junk at end of line, first unrecognized character is `@'
can't resolve __table_entries.2720' {.tbl.net_device_configurators.99 section} - __table_entries.2722' {.tbl.net_device_configurators.00 section} can't resolve __table_entries.2796' {.tbl.net_device_configurators.99 section} - __table_entries.2798' {.tbl.net_device_configurators.00 section}

I ended up using IPXE master and the OpenSUSE ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch I have not followed this up to find which commit fixes my build yet.

How close to ready are the standalone IPXE patches?

For QEMU, this commit:
https://github.com/qemu/qemu/commit/84c868f6b8f8c1be9d3d65df93cf00b30821401c.patch
84c868f6b8f8c1be9d3d65df93cf00b30821401c

In tools/ocaml/libs/xc/xenctrl_stubs.c
char error_str[1028];

CC xenctrl_stubs.o
xenctrl_stubs.c: In function 'failwith_xc':
xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]

      "%d: %s: %s", error->code,
                 ^
xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
    snprintf(error_str, sizeof(error_str),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      "%d: %s: %s", error->code,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~
      xc_error_code_to_desc(error->code),
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      error->message);
      ~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

I changed these, but am not sure if this is correct? char error_str[XC_MAX_ERROR_MSG_LEN + 6] sizeof(error_str) - 1 in the three snprintf

/build/xen-git/src/xen/stubdom/tpm_emulator-x86_64/tpm/tpm_deprecated.c:437:7: error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]

   if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Not sure how to approach this, I disabled the vtpm stubdoms in my builds for now.

Cheers,

Signature · 6 lines
  John Thomson

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 21 lines · John Thomson

Hi,
Trying to build Xen staging with GCC 8.1.0 and facing some of the new warnings:

For OVMF, I used these three commits:
https://github.com/tianocore/edk2/compare/1d212a83df0eaf32a6f5d4159beb2d77832e0231^...9de306701312f986c9638cb819d3f1f848d55cab.patch
1d212a83df0eaf32a6f5d4159beb2d77832e0231
9222154ae7b3eef75ae88cdb56158256227cb929
9de306701312f986c9638cb819d3f1f848d55cab

For IPXE, one of these patches:
http://lists.ipxe.org/pipermail/ipxe-devel/2018-April/006146.html
https://build.opensuse.org/package/view_file/openSUSE:Factory/qemu/ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch?expand=1

I was still unable to build IPXE at the Xen selected commit in tools/firmware/etherboot/Makefile:IPXE_GIT_TAG, with Errors:
[BUILD] bin/netdevice.o
Assembler messages
junk at end of line, first unrecognized character is `@'
can't resolve __table_entries.2720' {.tbl.net_device_configurators.99 section} - __table_entries.2722' {.tbl.net_device_configurators.00 section} can't resolve __table_entries.2796' {.tbl.net_device_configurators.99 section} - __table_entries.2798' {.tbl.net_device_configurators.00 section}

Quoted 4 lines

I ended up using IPXE master and the OpenSUSE ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch I have not followed this up to find which commit fixes my build yet.

How close to ready are the standalone IPXE patches?

It has gathered some comments. v2 is not yet posted. At this point it is definitely N+1 material.

I don't think having it merged in N+1 will be a big problem though, provided we find enough bandwidth to work on it.

Quoted 23 lines

For QEMU, this commit:
https://github.com/qemu/qemu/commit/84c868f6b8f8c1be9d3d65df93cf00b30821401c.patch
84c868f6b8f8c1be9d3d65df93cf00b30821401c

In tools/ocaml/libs/xc/xenctrl_stubs.c
char error_str[1028];

CC xenctrl_stubs.o
xenctrl_stubs.c: In function 'failwith_xc':
xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]

      "%d: %s: %s", error->code,
                 ^
xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
    snprintf(error_str, sizeof(error_str),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      "%d: %s: %s", error->code,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~
      xc_error_code_to_desc(error->code),
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      error->message);
      ~~~~~~~~~~~~~~~
Quoted 5 lines

cc1: all warnings being treated as errors

I changed these, but am not sure if this is correct? char error_str[XC_MAX_ERROR_MSG_LEN + 6] sizeof(error_str) - 1 in the three snprintf

Bumping the size should be fine.

Quoted 8 lines

/build/xen-git/src/xen/stubdom/tpm_emulator-x86_64/tpm/tpm_deprecated.c:437:7: error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]

   if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Not sure how to approach this, I disabled the vtpm stubdoms in my builds for now.

If you don't use it, disabling it is the best option.

Wei.

Quoted 10 lines

Cheers,

Signature · 6 lines
  John Thomson

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 10 lines · Wei Liu
Quoted 7 lines · John Thomson

/build/xen-git/src/xen/stubdom/tpm_emulator-x86_64/tpm/tpm_deprecated.c:437:7: error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]

   if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Not sure how to approach this, I disabled the vtpm stubdoms in my builds for now.

If you don't use it, disabling it is the best option.

A fix is proposed upstream:
https://github.com/PeterHuewe/tpm-emulator/pull/30/commits/910c43273c9f3373f93c2e8b8b0929d89fdcead6

Regards,
Jason

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 6 lines · Jason Andryuk
Quoted 4 lines · John Thomson
Quoted 3 lines

/build/xen-git/src/xen/stubdom/tpm_emulator-x86_64/tpm/tpm_deprecated.c:437:7: error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]

   if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A fix is proposed upstream:
https://github.com/PeterHuewe/tpm-emulator/pull/30/commits/910c43273c9f3373f93c2e8b8b0929d89fdcead6

Thank you, I had completely missed that.

The qemu-xen patches to fix gcc-8 warnings are in qemu-xen staging, but they are not yet in master. This will need a new tag for the next 4.11rc when they come through?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

For IPXE, one of these patches:
https://build.opensuse.org/package/view_file/openSUSE:Factory/qemu/ipxe-efi-guard-strncpy-with-gcc-warning-ignore-pragma.patch?expand=1

For IPXE I needed the [build] Use -no-pie on newer versions of gcc patch, as well as the guard-strncpy patch.
https://github.com/ipxe/ipxe/commit/7c395b0e21806b946fe944a27fc273407f357ea1

Cheers,

Signature · 6 lines
  John Thomson

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel