Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 845099

Summary: app-emulation/xen-tools-4.16.0-r4 with gcc-12.1: arch/x86/include/bits/string.h:79:32: error: array subscript ‘union <anonymous>[0]’ is partly outside array bounds of ‘union <anonymous>[1]’ [-Werror=array-bounds]
Product: Gentoo Linux Reporter: Kobboi <gentoo>
Component: Current packagesAssignee: Tomáš Mózes <hydrapolic>
Status: RESOLVED FIXED    
Severity: normal CC: esigra, proxy-maint, xen
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/25839
https://github.com/gentoo/gentoo/pull/26217
https://bugs.gentoo.org/show_bug.cgi?id=856583
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 260867, 839906    
Attachments: build.log.gz
emerge-info.txt

Description Kobboi 2022-05-16 23:07:11 UTC
Using gcc-12.1.1_pre20220514:

(...)

  [BUILD] bin/interface.o
In file included from include/string.h:23,
                 from include/ipxe/uaccess.h:25,
                 from core/acpi.c:28:
In function ‘__constant_memcpy’,
    inlined from ‘memcpy’ at arch/x86/include/bits/string.h:168:10,
    inlined from ‘trivial_memcpy_user’ at include/ipxe/uaccess.h:109:2,
    inlined from ‘memcpy_user’ at arch/x86/include/librm.h:155:2,
    inlined from ‘copy_from_user’ at include/ipxe/uaccess.h:338:2,
    inlined from ‘acpi_sx_zsdt’ at core/acpi.c:220:3:
arch/x86/include/bits/string.h:79:32: error: array subscript ‘union <anonymous>[0]’ is partly outside array bounds of ‘union <anonymous>[1]’ [-Werror=array-bounds]
   79 |                 dest_u->u32[0] = src_u->u32[0];
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
core/acpi.c: In function ‘acpi_sx_zsdt’:
core/acpi.c:194:11: note: object ‘buf’ of size 4
  194 |         } buf;
      |           ^~~
  [BUILD] bin/iobuf.o
  [BUILD] bin/iomap_virt.o
  [BUILD] bin/isqrt.o
  [BUILD] bin/job.o
  [BUILD] bin/linebuf.o
  [BUILD] bin/lineconsole.o
  [BUILD] bin/list.o
  [BUILD] bin/log.o
  [BUILD] bin/main.o
  [BUILD] bin/malloc.o
(...)



Reproducible: Always
Comment 1 Kobboi 2022-05-16 23:07:21 UTC
Created attachment 779282 [details]
build.log.gz
Comment 2 Kobboi 2022-05-16 23:07:23 UTC
Created attachment 779285 [details]
emerge-info.txt
Comment 3 Kobboi 2022-05-23 14:19:12 UTC
It seems Fedora is handling this by setting this warning as non-fatal:

https://src.fedoraproject.org/rpms/xen/blob/rawhide/f/xen.gcc12.fixes.patch

$(call cc-option-add,CFLAGS,CC,-Wno-error=array-bounds)
Comment 4 Kobboi 2022-05-23 14:33:22 UTC
Should have taken a closer look because that patch does not fix the error logged. Also, seems like we're maintaining a patchset out-of-tree so I can't really help there.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-10 10:25:56 UTC
ping
Comment 6 Florian Schmaus gentoo-dev 2022-06-10 20:41:08 UTC
The errors origin in ("bundled") ipxe. I am not sure what the best course of action is. I think that the current version of sys-firmware/ipxe 1.21.1 should be also affected by this, because it appears to be even older than the Xen version (1.21.1 is from 2020-12-31, the Xen version 3c040ad, is from 2021-06-11).

We could try to apply upstream commit 02ec659b73b0 ("[acpi] Generalise DSDT/SSDT data extraction logic"), that looks like it could at least fix one error.
Comment 7 Kobboi 2022-06-10 20:55:00 UTC
FYI, ipxe-1.21.1[*,-binary] compiles just fine with gcc-12.2.9999 (May 30th version)
Comment 8 Florian Schmaus gentoo-dev 2022-06-10 22:09:15 UTC
(In reply to Kobboi from comment #7)
> FYI, ipxe-1.21.1[*,-binary] compiles just fine with gcc-12.2.9999 (May 30th
> version)

Try removing the "export NO_WERROR=1" [1] in the ebuild's src_compile() phase. Then it will fail with the same errors.

1: https://github.com/gentoo/gentoo/blob/1c040cb550fa6ab596ec2297f47113d7a4fd90a4/sys-firmware/ipxe/ipxe-1.21.1.ebuild#L78
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-21 04:31:40 UTC
With some luck, GCC 12 will be unleashed in ~arch around Sunday. If a bug gets fixed upstream.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-25 05:06:26 UTC
(In reply to Sam James from comment #9)
> With some luck, GCC 12 will be unleashed in ~arch around Sunday. If a bug
> gets fixed upstream.

ping
Comment 11 Larry the Git Cow gentoo-dev 2022-07-05 16:23:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b48c2d2662337ed28190d32ad3898686959dccd5

commit b48c2d2662337ed28190d32ad3898686959dccd5
Author:     Florian Schmaus <flow@gentoo.org>
AuthorDate: 2022-07-04 10:22:01 +0000
Commit:     Florian Schmaus <flow@gentoo.org>
CommitDate: 2022-07-05 16:20:56 +0000

    app-emulation/xen-tools: add 4.16.1, 4.16.2_pre1
    
    This introduces a new approach to handle Xen patching and versioning. SECURITY_VER and
    OVMF_VER where dropped as those have not been used in a while. We now
    consume the upstream patches from a repository called
    xen-upstream-patches, which will ultimately be hosted by Gentoo
    infra (e.g. available under gitweb.gentoo.org). The Gentoo patchset now
    lives in a repository called xen-gentoo-patches, which will also be
    hosted on Gentoo infra.
    
    Furthermore we now follow upstreams versioning scheme. Previously we
    would sell Xen 4.16.2-pre, which is from the staging-4.16 branch
    containing security fixes, as Xen 4.16.1. To avoid confusion, we will
    label the Xen versions as such, and Xen 4.16.1 will what is tagged
    upstream as RELEASE-4.16.1 (+ the few Gentoo specific patches).
    
    Closes: https://bugs.gentoo.org/845099
    Bug: https://bugs.gentoo.org/850802
    Closes: https://github.com/gentoo/gentoo/pull/25839
    Signed-off-by: Florian Schmaus <flow@gentoo.org>

 app-emulation/xen-tools/Manifest                   |   3 +
 app-emulation/xen-tools/xen-tools-4.16.1.ebuild    | 526 +++++++++++++++++++++
 .../xen-tools/xen-tools-4.16.2_pre1.ebuild         | 526 +++++++++++++++++++++
 3 files changed, 1055 insertions(+)