summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Mulvey2022-05-16 11:59:36 -0700
committerSam Mulvey2022-05-16 11:59:36 -0700
commitf7971a3dbdd806bfe71366cf6d91a0c0e1ff0c98 (patch)
tree30943b7c3cfeb3648eddccdbbec1238f4ded7593
parent8c88ec2784c97e91dd385acdc0aefd5744fd2da4 (diff)
downloadaur-f7971a3dbdd806bfe71366cf6d91a0c0e1ff0c98.tar.gz
4.16.1-1, GCC12 fixes
-rw-r--r--.SRCINFO55
-rw-r--r--ChangeLog5
-rw-r--r--PKGBUILD36
-rw-r--r--add-stubdom-fixes.patch11
-rw-r--r--gcc12-fixes.patch428
-rw-r--r--vtpm-gcc12-fixes.patch14
6 files changed, 522 insertions, 27 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f895757a2981..ca6640a60e11 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = xen
pkgdesc = Open-source type-1 or baremetal hypervisor
- pkgver = 4.16.0
- pkgrel = 3
+ pkgver = 4.16.1
+ pkgrel = 1
url = https://xenproject.org/
arch = x86_64
license = GPL2
@@ -40,24 +40,38 @@ pkgbase = xen
makedepends = ocaml
makedepends = ocaml-findlib
makedepends = fig2dev
+ makedepends = cmake
makedepends = ninja
- noextract = xsa393.patch
- noextract = xsa394.patch
- noextract = xsa395.patch
+ noextract = gmp-4.3.2.tar.bz2
+ noextract = grub-0.97.tar.gz
+ noextract = lwip-1.3.0.tar.gz
+ noextract = newlib-1.16.0.tar.gz
+ noextract = pciutils-2.2.9.tar.bz2
+ noextract = polarssl-1.1.4-gpl.tgz
+ noextract = tpm_emulator-0.7.4.tar.gz
+ noextract = zlib-1.2.3.tar.gz
options = !buildflags
- source = https://downloads.xenproject.org/release/xen/4.16.0/xen-4.16.0.tar.gz
- source = https://downloads.xenproject.org/release/xen/4.16.0/xen-4.16.0.tar.gz.sig
+ source = https://downloads.xenproject.org/release/xen/4.16.1/xen-4.16.1.tar.gz
+ source = https://downloads.xenproject.org/release/xen/4.16.1/xen-4.16.1.tar.gz.sig
source = efi-xen.cfg
source = xen.conf
source = tmpfiles.conf
source = xen-ucode-extract.sh
source = xen-intel-ucode.hook
source = xen-amd-ucode.hook
- source = https://xenbits.xen.org/xsa/xsa393.patch
- source = https://xenbits.xen.org/xsa/xsa394.patch
- source = https://xenbits.xen.org/xsa/xsa395.patch
+ source = gcc12-fixes.patch
+ source = vtpm-gcc12-fixes.patch
+ source = add-stubdom-fixes.patch
+ source = http://xenbits.xen.org/xen-extfiles/gmp-4.3.2.tar.bz2
+ source = http://xenbits.xen.org/xen-extfiles/grub-0.97.tar.gz
+ source = http://xenbits.xen.org/xen-extfiles/lwip-1.3.0.tar.gz
+ source = http://xenbits.xen.org/xen-extfiles/newlib-1.16.0.tar.gz
+ source = http://xenbits.xen.org/xen-extfiles/pciutils-2.2.9.tar.bz2
+ source = http://xenbits.xen.org/xen-extfiles/polarssl-1.1.4-gpl.tgz
+ source = http://xenbits.xen.org/xen-extfiles/tpm_emulator-0.7.4.tar.gz
+ source = http://xenbits.xen.org/xen-extfiles/zlib-1.2.3.tar.gz
validpgpkeys = 23E3222C145F4475FA8060A783FE14C957E82BD9
- sha512sums = 2869ed90d1779c9754d7f2397f5fc67a655304d9c32953ac20655ef96cb154521d8fce9f23915ac0c91f984dc54f72c67e5e619e2da318b5997748f44cf21b87
+ sha512sums = eeabba9c263cd2425bca083e32b5ebfc6c716c00553759c144fd4b6f64a89836b260787fa25ba22c1f5c4ea65aaad7c95b8c2c1070d3377b1c43c9517aa7032a
sha512sums = SKIP
sha512sums = 1bbcbcd9fb8344a207409ec9f0064a45b726416f043f902ca587f5e4fa58497a759be4ffd584fa32318e960aa478864cc05ec026c444e8d27ca8e3248bd67420
sha512sums = ccaa2ff82e4203b11e5dec9aeccac2e165721d8067e0094603ecaa7a70b78c9eb9e2287a32687883d26b6ceae6f8d2ad7636ddf949eb658637b3ceaa6999711b
@@ -65,9 +79,17 @@ pkgbase = xen
sha512sums = a9230ec6ef9636ac3f3e4b72b1747ee8c4648a8bf4bd8dc3650365e34f1f67474429dbdd24996907d277b0ff5f235574643e781cb3ff37da954e899ddadbe0d6
sha512sums = 7a832de9b35f4b77ee80d33310b23886f4d48d1d42c3d6ef6f8e2b428bec7332a285336864b61cfa01d9a14c2023674015beb7527bd5849b069f2be88e6500cd
sha512sums = 99921b94a29fa7988c7fb5c17da8e598e777c972d6cae8c8643c991e5ff911a25525345ea8913945313d5c49fecf9da8cc3b83d47ab03928341e917b304370a9
- sha512sums = 32efed25f988579be8266a6bc80ed7c09c408519c6b6c5264b7e032849e3accc7ddea19c5879c06d7e7b27308d06e114f6e3ca4f814d53b9be9d239fb09c71f1
- sha512sums = a0afa766e492a4dc921cd5c4c43c9ecbe87f79c07986504c8626ab7f06736147bdfa4637ea4c4abf17b9f1df31056bbcbb6c51a52e244e57467564c8ea06a52e
- sha512sums = 0aafb55b88a7feefeb0162b2722efc8ad43edcdfc7926492e1d49945eafb8dda900f7da37b2d49fd4dbc2d0c9a068ad6e47674a6df108a58842275695ed73540
+ sha512sums = 3f03e61a9c0b52db79f264a877589f09d7ebbc6a17da93a581e3ae38993ae15b340d49c62da4f21dbbcac3ec8251331e5253f3980f0e4874acf4545dfbaacfc6
+ sha512sums = 2397795a0a4999a6efee3d8291356673d1757bc1b34dd2015378ef6ea8800ee1317c7d9f902d82bd62ff8d451223ad51ced5e3a6d66e8e79930a7f513cc2b805
+ sha512sums = e379a2c072a1a42973aaddd1d8046ab68be50fd386bb718f73fc7401f412a40be3dab94b01e5364604216f39c867a9d6ed1751589c318b45faa28acf33875930
+ sha512sums = 2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf
+ sha512sums = c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb
+ sha512sums = 1465b58279af1647f909450e394fe002ca165f0ff4a0254bfa9fe0e64316f50facdde2729d79a4e632565b4500cf4d6c74192ac0dd3bc9fe09129bbd67ba089d
+ sha512sums = 40eb96bbc6736a16b6399e0cdb73e853d0d90b685c967e77899183446664d64570277a633fdafdefc351b46ce210a99115769a1d9f47ac749d7e82837d4d1ac3
+ sha512sums = 2b3d98d027e46d8c08037366dde6f0781ca03c610ef2b380984639e4ef39899ed8d8b8e4cd9c9dc54df101279b95879bd66bfd4d04ad07fef41e847ea7ae32b5
+ sha512sums = 88da614e4d3f4409c4fd3bb3e44c7587ba051e3fed4e33d526069a67e8180212e1ea22da984656f50e290049f60ddca65383e5983c0f8884f648d71f698303ad
+ sha512sums = 4928b5b82f57645be9408362706ff2c4d9baa635b21b0d41b1c82930e8c60a759b1ea4fa74d7e6c7cae1b7692d006aa5cb72df0c3b88bf049779aa2b566f9d35
+ sha512sums = 021b958fcd0d346c4ba761bcf0cc40f3522de6186cf5a0a6ea34a70504ce9622b1c2626fce40675bc8282cf5f5ade18473656abc38050f72f5d6480507a2106e
pkgname = xen
pkgdesc = Open-source type-1 or baremetal hypervisor
@@ -112,6 +134,11 @@ pkgname = xen-docs
pkgdesc = Xen hypervisor documentation and man pages
arch = any
+pkgname = xen-stubdom
+ pkgdesc = Xen hypervisor stubdom files
+ arch = x86_64
+ depends = xen
+
pkgname = xen-qemu-builtin
pkgdesc = Xen hypervisor QEMU components
arch = x86_64
diff --git a/ChangeLog b/ChangeLog
index e028522ceed7..6d3ca3061bed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-05-16
+ * 4.16.1-1
+ * Version increment
+ * Numerous GCC12 hacks
+
2022-02-15
* 4.16.0-3
* forgot to wrap qemu subpackage in an if
diff --git a/PKGBUILD b/PKGBUILD
index 436961c18314..f6177e0aed7f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -21,8 +21,8 @@ _zlib=1.2.3
pkgbase=xen
pkgname=("xen" "xen-docs")
-pkgver=4.16.0
-pkgrel=3
+pkgver=4.16.1
+pkgrel=1
pkgdesc='Open-source type-1 or baremetal hypervisor'
arch=('x86_64')
url='https://xenproject.org/'
@@ -46,6 +46,10 @@ _source=(
"xen-ucode-extract.sh"
"xen-intel-ucode.hook"
"xen-amd-ucode.hook"
+ "gcc12-fixes.patch" # from https://build.opensuse.org/package/show/openSUSE:Factory/xen
+ "vtpm-gcc12-fixes.patch" # based on above patch
+ "add-stubdom-fixes.patch" # add above patch to build
+
)
validpgpkeys=('23E3222C145F4475FA8060A783FE14C957E82BD9') # Xen.org Xen tree code signing (signatures on the xen hypervisor and tools) <pgp@xen.org>
@@ -54,10 +58,6 @@ validpgpkeys=('23E3222C145F4475FA8060A783FE14C957E82BD9') # Xen.org Xen tree cod
# Follow the Xen securite mailing lists, and if a patch is applicable to our package
# add the URL here.
_patches=(
- "https://xenbits.xen.org/xsa/xsa393.patch"
- "https://xenbits.xen.org/xsa/xsa394.patch"
- "https://xenbits.xen.org/xsa/xsa395.patch"
-
)
@@ -76,21 +76,21 @@ _stubdom_source=(
# from cheap hack known as break_out_sums.sh
_sha512sums=(
- "2869ed90d1779c9754d7f2397f5fc67a655304d9c32953ac20655ef96cb154521d8fce9f23915ac0c91f984dc54f72c67e5e619e2da318b5997748f44cf21b87" # xen-4.16.0.tar.gz
- "SKIP" # xen-4.16.0.tar.gz.sig
+ "eeabba9c263cd2425bca083e32b5ebfc6c716c00553759c144fd4b6f64a89836b260787fa25ba22c1f5c4ea65aaad7c95b8c2c1070d3377b1c43c9517aa7032a" # xen-4.16.1.tar.gz
+ "SKIP" # xen-4.16.1.tar.gz.sig
"1bbcbcd9fb8344a207409ec9f0064a45b726416f043f902ca587f5e4fa58497a759be4ffd584fa32318e960aa478864cc05ec026c444e8d27ca8e3248bd67420" # efi-xen.cfg
"ccaa2ff82e4203b11e5dec9aeccac2e165721d8067e0094603ecaa7a70b78c9eb9e2287a32687883d26b6ceae6f8d2ad7636ddf949eb658637b3ceaa6999711b" # xen.conf
"53ba61587cc2e84044e935531ed161e22c36d9e90b43cab7b8e63bcc531deeefacca301b5dff39ce89210f06f1d1e4f4f5cf49d658ed5d9038c707e3c95c66ef" # tmpfiles.conf
"a9230ec6ef9636ac3f3e4b72b1747ee8c4648a8bf4bd8dc3650365e34f1f67474429dbdd24996907d277b0ff5f235574643e781cb3ff37da954e899ddadbe0d6" # xen-ucode-extract.sh
"7a832de9b35f4b77ee80d33310b23886f4d48d1d42c3d6ef6f8e2b428bec7332a285336864b61cfa01d9a14c2023674015beb7527bd5849b069f2be88e6500cd" # xen-intel-ucode.hook
"99921b94a29fa7988c7fb5c17da8e598e777c972d6cae8c8643c991e5ff911a25525345ea8913945313d5c49fecf9da8cc3b83d47ab03928341e917b304370a9" # xen-amd-ucode.hook
+ "3f03e61a9c0b52db79f264a877589f09d7ebbc6a17da93a581e3ae38993ae15b340d49c62da4f21dbbcac3ec8251331e5253f3980f0e4874acf4545dfbaacfc6" # gcc12-fixes.patch
+ "2397795a0a4999a6efee3d8291356673d1757bc1b34dd2015378ef6ea8800ee1317c7d9f902d82bd62ff8d451223ad51ced5e3a6d66e8e79930a7f513cc2b805" # vtpm-gcc12-fixes.patch
+ "e379a2c072a1a42973aaddd1d8046ab68be50fd386bb718f73fc7401f412a40be3dab94b01e5364604216f39c867a9d6ed1751589c318b45faa28acf33875930" # add-stubdom-fixes.patch
)
_patch_sums=(
- "32efed25f988579be8266a6bc80ed7c09c408519c6b6c5264b7e032849e3accc7ddea19c5879c06d7e7b27308d06e114f6e3ca4f814d53b9be9d239fb09c71f1" # xsa393.patch
- "a0afa766e492a4dc921cd5c4c43c9ecbe87f79c07986504c8626ab7f06736147bdfa4637ea4c4abf17b9f1df31056bbcbb6c51a52e244e57467564c8ea06a52e" # xsa394.patch
- "0aafb55b88a7feefeb0162b2722efc8ad43edcdfc7926492e1d49945eafb8dda900f7da37b2d49fd4dbc2d0c9a068ad6e47674a6df108a58842275695ed73540" # xsa395.patch
)
@@ -105,6 +105,8 @@ _stub_sums=(
"021b958fcd0d346c4ba761bcf0cc40f3522de6186cf5a0a6ea34a70504ce9622b1c2626fce40675bc8282cf5f5ade18473656abc38050f72f5d6480507a2106e" # zlib-1.2.3.tar.gz
)
+
+
# Simplify things for makepkg
source=( "${_source[@]}" "${_patches[@]}" )
sha512sums=( "${_sha512sums[@]}" "${_patch_sums[@]}" )
@@ -166,6 +168,11 @@ prepare() {
fi
+ echo "==> Applying GCC 12.1 fixes..."
+ patch -p1 < ../gcc12-fixes.patch
+ cp ../vtpm-gcc12-fixes.patch stubdom/
+ patch -p1 < ../add-stubdom-fixes.patch
+
for patchurl in "${_patches[@]}"; do
patch=$(basename $patchurl)
@@ -292,8 +299,11 @@ package_xen() {
rm -r "${pkgdir}/usr/share/doc"
rm -r "${pkgdir}/usr/share/man"
- # remove potential stubdom files
- rm -r "${pkgdir}/usr/lib/xen/boot"
+ # remove stubdom files
+ rm -f "${pkgdir}/usr/lib/xen/boot/vtpmmgr-stubdom.gz" \
+ "${pkgdir}/usr/lib/xen/boot/vtpm-stubdom.gz" \
+ "${pkgdir}/usr/lib/xen/boot/xenstorepvh-stubdom.gz" \
+ "${pkgdir}/usr/lib/xen/boot/xenstore-stubdom.gz"
# remove qemu
if [ "${_build_qemu}" == "true" ]; then
diff --git a/add-stubdom-fixes.patch b/add-stubdom-fixes.patch
new file mode 100644
index 000000000000..e063bd3e5bfd
--- /dev/null
+++ b/add-stubdom-fixes.patch
@@ -0,0 +1,11 @@
+diff -Naur orig.xen-4.16.1/stubdom/Makefile xen-4.16.1/stubdom/Makefile
+--- orig.xen-4.16.1/stubdom/Makefile 2022-05-16 09:41:38.409898784 -0700
++++ xen-4.16.1/stubdom/Makefile 2022-05-16 09:43:31.891076356 -0700
+@@ -241,6 +241,7 @@
+ patch -d $@ -p1 < vtpm_extern.patch
+ patch -d $@ -p1 < vtpm-microsecond-duration.patch
+ patch -d $@ -p1 < vtpm-command-duration.patch
++ patch -d $@ -p1 < vtpm-gcc12-fixes.patch
+ mkdir $@/build
+ cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
+ touch $@
diff --git a/gcc12-fixes.patch b/gcc12-fixes.patch
new file mode 100644
index 000000000000..cf9d0085d331
--- /dev/null
+++ b/gcc12-fixes.patch
@@ -0,0 +1,428 @@
+References: bsc#1196545
+
+Compiling against gcc12.
+
+Many of the failures are -Werror=array-bounds where macros
+from mm.h are being used. Common Examples are,
+include/asm/mm.h:528:61: error: array subscript 0 is outside array bounds of 'long unsigned int[0]' [-Werror=array-bounds]
+include/xen/mm.h:287:21: error: array subscript [0, 288230376151711743] is outside array bounds of 'struct page_info[0]' [-Werror=array-bounds]
+
+There are also several other headers that generate array-bounds macro failures.
+The pragmas to override are mostly in '.c' files with the exception of,
+xen/arch/x86/mm/shadow/private.h
+xen/include/asm-x86/paging.h
+
+
+Index: xen-4.16.1-testing/xen/drivers/passthrough/amd/iommu_intr.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/drivers/passthrough/amd/iommu_intr.c
++++ xen-4.16.1-testing/xen/drivers/passthrough/amd/iommu_intr.c
+@@ -23,6 +23,10 @@
+
+ #include "iommu.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ union irte32 {
+ uint32_t raw;
+ struct {
+Index: xen-4.16.1-testing/xen/drivers/passthrough/x86/hvm.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/drivers/passthrough/x86/hvm.c
++++ xen-4.16.1-testing/xen/drivers/passthrough/x86/hvm.c
+@@ -901,6 +901,9 @@ static void __hvm_dpci_eoi(struct domain
+ hvm_pirq_eoi(pirq);
+ }
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Waddress"
++#endif
+ static void hvm_gsi_eoi(struct domain *d, unsigned int gsi)
+ {
+ struct pirq *pirq = pirq_info(d, gsi);
+Index: xen-4.16.1-testing/xen/common/domctl.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/common/domctl.c
++++ xen-4.16.1-testing/xen/common/domctl.c
+@@ -32,6 +32,10 @@
+ #include <public/domctl.h>
+ #include <xsm/xsm.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ static DEFINE_SPINLOCK(domctl_lock);
+
+ static int nodemask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_nodemap,
+Index: xen-4.16.1-testing/xen/common/efi/boot.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/common/efi/boot.c
++++ xen-4.16.1-testing/xen/common/efi/boot.c
+@@ -31,6 +31,10 @@
+ #undef __ASSEMBLY__
+ #endif
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ #define EFI_REVISION(major, minor) (((major) << 16) | (minor))
+
+ #define SMBIOS3_TABLE_GUID \
+Index: xen-4.16.1-testing/xen/common/xmalloc_tlsf.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/common/xmalloc_tlsf.c
++++ xen-4.16.1-testing/xen/common/xmalloc_tlsf.c
+@@ -28,6 +28,10 @@
+ #include <xen/pfn.h>
+ #include <asm/time.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ #define MAX_POOL_NAME_LEN 16
+
+ /* Some IMPORTANT TLSF parameters */
+Index: xen-4.16.1-testing/xen/common/memory.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/common/memory.c
++++ xen-4.16.1-testing/xen/common/memory.c
+@@ -35,6 +35,10 @@
+ #include <asm/guest.h>
+ #endif
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ struct memop_args {
+ /* INPUT */
+ struct domain *domain; /* Domain to be affected. */
+Index: xen-4.16.1-testing/xen/common/page_alloc.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/common/page_alloc.c
++++ xen-4.16.1-testing/xen/common/page_alloc.c
+@@ -155,6 +155,10 @@
+ #define PGC_reserved 0
+ #endif
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /*
+ * Comma-separated list of hexadecimal page numbers containing bad bytes.
+ * e.g. 'badpage=0x3f45,0x8a321'.
+@@ -1529,6 +1533,7 @@ static void free_heap_pages(
+ }
+
+
++
+ /*
+ * Following rules applied for page offline:
+ * Once a page is broken, it can't be assigned anymore
+Index: xen-4.16.1-testing/xen/common/vmap.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/common/vmap.c
++++ xen-4.16.1-testing/xen/common/vmap.c
+@@ -9,6 +9,10 @@
+ #include <xen/vmap.h>
+ #include <asm/page.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ static DEFINE_SPINLOCK(vm_lock);
+ static void *__read_mostly vm_base[VMAP_REGION_NR];
+ #define vm_bitmap(x) ((unsigned long *)vm_base[x])
+Index: xen-4.16.1-testing/xen/include/asm-x86/paging.h
+===================================================================
+--- xen-4.16.1-testing.orig/xen/include/asm-x86/paging.h
++++ xen-4.16.1-testing/xen/include/asm-x86/paging.h
+@@ -32,6 +32,10 @@
+ #include <asm/flushtlb.h>
+ #include <asm/domain.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /*****************************************************************************
+ * Macros to tell which paging mode a domain is in */
+
+Index: xen-4.16.1-testing/xen/arch/x86/x86_64/traps.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/x86_64/traps.c
++++ xen-4.16.1-testing/xen/arch/x86/x86_64/traps.c
+@@ -25,6 +25,9 @@
+ #include <asm/hvm/hvm.h>
+ #include <asm/hvm/support.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
+
+ static void print_xen_info(void)
+ {
+Index: xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mcaction.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/cpu/mcheck/mcaction.c
++++ xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mcaction.c
+@@ -4,6 +4,10 @@
+ #include "vmce.h"
+ #include "mce.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ static struct mcinfo_recovery *
+ mci_action_add_pageoffline(int bank, struct mc_info *mi,
+ mfn_t mfn, uint32_t status)
+Index: xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mce.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/cpu/mcheck/mce.c
++++ xen-4.16.1-testing/xen/arch/x86/cpu/mcheck/mce.c
+@@ -30,6 +30,10 @@
+ #include "util.h"
+ #include "vmce.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ bool __read_mostly opt_mce = true;
+ boolean_param("mce", opt_mce);
+ bool __read_mostly mce_broadcast;
+Index: xen-4.16.1-testing/xen/arch/x86/hvm/hvm.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/hvm/hvm.c
++++ xen-4.16.1-testing/xen/arch/x86/hvm/hvm.c
+@@ -81,6 +81,10 @@
+
+ #include <compat/hvm/hvm_op.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ bool_t __read_mostly hvm_enabled;
+
+ #ifdef DBG_LEVEL_0
+Index: xen-4.16.1-testing/xen/arch/x86/pv/dom0_build.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/pv/dom0_build.c
++++ xen-4.16.1-testing/xen/arch/x86/pv/dom0_build.c
+@@ -22,6 +22,10 @@
+ #include <asm/pv/mm.h>
+ #include <asm/setup.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /* Allow ring-3 access in long mode as guest cannot use ring 1 ... */
+ #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
+ #define L1_PROT (BASE_PROT|_PAGE_GUEST_KERNEL)
+Index: xen-4.16.1-testing/xen/arch/x86/pv/ro-page-fault.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/pv/ro-page-fault.c
++++ xen-4.16.1-testing/xen/arch/x86/pv/ro-page-fault.c
+@@ -26,6 +26,10 @@
+ #include "emulate.h"
+ #include "mm.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /*********************
+ * Writable Pagetables
+ */
+Index: xen-4.16.1-testing/xen/arch/x86/pv/emul-priv-op.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/pv/emul-priv-op.c
++++ xen-4.16.1-testing/xen/arch/x86/pv/emul-priv-op.c
+@@ -40,6 +40,10 @@
+ #include "emulate.h"
+ #include "mm.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ struct priv_op_ctxt {
+ struct x86_emulate_ctxt ctxt;
+ struct {
+Index: xen-4.16.1-testing/xen/arch/x86/pv/mm.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/pv/mm.c
++++ xen-4.16.1-testing/xen/arch/x86/pv/mm.c
+@@ -26,6 +26,10 @@
+
+ #include "mm.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /*
+ * Get a mapping of a PV guest's l1e for this linear address. The return
+ * pointer should be unmapped using unmap_domain_page().
+Index: xen-4.16.1-testing/xen/arch/x86/domain_page.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/domain_page.c
++++ xen-4.16.1-testing/xen/arch/x86/domain_page.c
+@@ -18,6 +18,10 @@
+ #include <asm/hardirq.h>
+ #include <asm/setup.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ static DEFINE_PER_CPU(struct vcpu *, override);
+
+ static inline struct vcpu *mapcache_current_vcpu(void)
+Index: xen-4.16.1-testing/xen/arch/x86/mm/shadow/private.h
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/mm/shadow/private.h
++++ xen-4.16.1-testing/xen/arch/x86/mm/shadow/private.h
+@@ -33,6 +33,10 @@
+
+ #include "../mm-locks.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /******************************************************************************
+ * Levels of self-test and paranoia
+ */
+Index: xen-4.16.1-testing/xen/arch/x86/mm/hap/hap.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/mm/hap/hap.c
++++ xen-4.16.1-testing/xen/arch/x86/mm/hap/hap.c
+@@ -42,6 +42,10 @@
+
+ #include "private.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /************************************************/
+ /* HAP VRAM TRACKING SUPPORT */
+ /************************************************/
+Index: xen-4.16.1-testing/xen/arch/x86/mm/p2m-pod.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/mm/p2m-pod.c
++++ xen-4.16.1-testing/xen/arch/x86/mm/p2m-pod.c
+@@ -31,6 +31,10 @@
+
+ #include "mm-locks.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ #define superpage_aligned(_x) (((_x)&(SUPERPAGE_PAGES-1))==0)
+
+ /* Enforce lock ordering when grabbing the "external" page_alloc lock */
+Index: xen-4.16.1-testing/xen/arch/x86/mm/p2m-ept.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/mm/p2m-ept.c
++++ xen-4.16.1-testing/xen/arch/x86/mm/p2m-ept.c
+@@ -36,6 +36,10 @@
+
+ #include "mm-locks.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ #define atomic_read_ept_entry(__pepte) \
+ ( (ept_entry_t) { .epte = read_atomic(&(__pepte)->epte) } )
+
+Index: xen-4.16.1-testing/xen/arch/x86/mm/p2m.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/mm/p2m.c
++++ xen-4.16.1-testing/xen/arch/x86/mm/p2m.c
+@@ -44,6 +44,10 @@
+
+ #include "mm-locks.h"
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /* Override macro from asm/page.h to make work with mfn_t */
+ #undef virt_to_mfn
+ #define virt_to_mfn(v) _mfn(__virt_to_mfn(v))
+Index: xen-4.16.1-testing/xen/arch/x86/tboot.c
+===================================================================
+--- xen-4.16.1-testing.orig/xen/arch/x86/tboot.c
++++ xen-4.16.1-testing/xen/arch/x86/tboot.c
+@@ -16,6 +16,10 @@
+ #include <asm/setup.h>
+ #include <crypto/vmac.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /* tboot=<physical address of shared page> */
+ static unsigned long __initdata opt_tboot_pa;
+ integer_param("tboot", opt_tboot_pa);
+Index: xen-4.16.1-testing/tools/firmware/hvmloader/ovmf.c
+===================================================================
+--- xen-4.16.1-testing.orig/tools/firmware/hvmloader/ovmf.c
++++ xen-4.16.1-testing/tools/firmware/hvmloader/ovmf.c
+@@ -34,6 +34,11 @@
+ #include <xen/hvm/ioreq.h>
+ #include <xen/memory.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#pragma GCC diagnostic ignored "-Wstringop-overflow"
++#endif
++
+ #define OVMF_MAXOFFSET 0x000FFFFFULL
+ #define OVMF_END 0x100000000ULL
+ #define LOWCHUNK_BEGIN 0x000F0000
+Index: xen-4.16.1-testing/tools/firmware/hvmloader/seabios.c
+===================================================================
+--- xen-4.16.1-testing.orig/tools/firmware/hvmloader/seabios.c
++++ xen-4.16.1-testing/tools/firmware/hvmloader/seabios.c
+@@ -29,6 +29,11 @@
+ #include <acpi2_0.h>
+ #include <libacpi.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#pragma GCC diagnostic ignored "-Wstringop-overflow"
++#endif
++
+ struct seabios_info {
+ char signature[14]; /* XenHVMSeaBIOS\0 */
+ uint8_t length; /* Length of this struct */
+Index: xen-4.16.1-testing/tools/firmware/hvmloader/util.c
+===================================================================
+--- xen-4.16.1-testing.orig/tools/firmware/hvmloader/util.c
++++ xen-4.16.1-testing/tools/firmware/hvmloader/util.c
+@@ -31,6 +31,10 @@
+ #include <xen/hvm/hvm_xs_strings.h>
+ #include <xen/hvm/params.h>
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Warray-bounds"
++#endif
++
+ /*
+ * Check whether there exists overlap in the specified memory range.
+ * Returns true if exists, else returns false.
diff --git a/vtpm-gcc12-fixes.patch b/vtpm-gcc12-fixes.patch
new file mode 100644
index 000000000000..a86bf007a924
--- /dev/null
+++ b/vtpm-gcc12-fixes.patch
@@ -0,0 +1,14 @@
+diff -Naur orig.tpm_emulator-0.7.4/crypto/rsa.h tpm_emulator-0.7.4/crypto/rsa.h
+--- orig.tpm_emulator-0.7.4/crypto/rsa.h 2022-05-16 09:33:22.000000000 -0700
++++ tpm_emulator-0.7.4/crypto/rsa.h 2022-05-16 09:34:03.000000000 -0700
+@@ -17,6 +17,10 @@
+ #ifndef _RSA_H_
+ #define _RSA_H_
+
++#if __GNUC__ >= 12
++#pragma GCC diagnostic ignored "-Waddress"
++#endif
++
+ #include <stddef.h>
+ #include <stdint.h>
+ #include "bn.h"