diff -Nru xen-4.9.2/debian/changelog xen-4.9.2/debian/changelog --- xen-4.9.2/debian/changelog 2018-05-03 14:20:24.000000000 +0000 +++ xen-4.9.2/debian/changelog 2019-10-10 19:07:53.000000000 +0000 @@ -1,3 +1,15 @@ +xen (4.9.2-0ubuntu4~ppa1) eoan; urgency=medium + + * Stuff. + + -- Adam Conrad Thu, 10 Oct 2019 13:07:53 -0600 + +xen (4.9.2-0ubuntu3) eoan; urgency=medium + + * No-change upload with strops.h and sys/strops.h removed in glibc. + + -- Matthias Klose Thu, 05 Sep 2019 11:16:44 +0000 + xen (4.9.2-0ubuntu2) cosmic; urgency=medium * No-change rebuild for ncurses soname changes. diff -Nru xen-4.9.2/debian/patches/fcf-protection.diff xen-4.9.2/debian/patches/fcf-protection.diff --- xen-4.9.2/debian/patches/fcf-protection.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/fcf-protection.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,15 @@ +Description: +Author: Adam Conrad +Last-Update: 2019-10-10 + +--- xen-4.9.2.orig/xen/Rules.mk ++++ xen-4.9.2/xen/Rules.mk +@@ -46,7 +46,7 @@ else + CFLAGS += -O2 -fomit-frame-pointer + endif + +-CFLAGS += -nostdinc -fno-builtin -fno-common ++CFLAGS += -nostdinc -fno-builtin -fno-common -fcf-protection=none + CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith + CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h + CFLAGS += '-D__OBJECT_FILE__="$@"' diff -Nru xen-4.9.2/debian/patches/gcc-9-ioapic.diff xen-4.9.2/debian/patches/gcc-9-ioapic.diff --- xen-4.9.2/debian/patches/gcc-9-ioapic.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-ioapic.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,169 @@ +From ca9310b24e6205de5387e5982ccd42c35caf89d4 Mon Sep 17 00:00:00 2001 +From: Jan Beulich +Date: Fri, 24 May 2019 10:19:59 +0200 +Subject: [PATCH] x86/IO-APIC: fix build with gcc9 + +There are a number of pointless __packed attributes which cause gcc 9 to +legitimately warn: + +utils.c: In function 'vtd_dump_iommu_info': +utils.c:287:33: error: converting a packed 'struct IO_APIC_route_entry' pointer (alignment 1) to a 'struct IO_APIC_route_remap_entry' pointer (alignment 8) may result in an unaligned pointer value [-Werror=address-of-packed-member] + 287 | remap = (struct IO_APIC_route_remap_entry *) &rte; + | ^~~~~~~~~~~~~~~~~~~~~~~~~ + +intremap.c: In function 'ioapic_rte_to_remap_entry': +intremap.c:343:25: error: converting a packed 'struct IO_APIC_route_entry' pointer (alignment 1) to a 'struct IO_APIC_route_remap_entry' pointer (alignment 8) may result in an unaligned pointer value [-Werror=address-of-packed-member] + 343 | remap_rte = (struct IO_APIC_route_remap_entry *) old_rte; + | ^~~~~~~~~~~~~~~~~~~~~~~~~ + +Simply drop these attributes. Take the liberty and also re-format the +structure definitions at the same time. + +Reported-by: Charles Arnold +Signed-off-by: Jan Beulich +Reviewed-by: Wei Liu +Reviewed-by: Andrew Cooper +--- + xen/include/asm-x86/io_apic.h | 113 +++++++++++++++++----------------- + 1 file changed, 57 insertions(+), 56 deletions(-) + +diff --git a/xen/include/asm-x86/io_apic.h b/xen/include/asm-x86/io_apic.h +index 5d4075f437d..0b041f05651 100644 +--- a/xen/include/asm-x86/io_apic.h ++++ b/xen/include/asm-x86/io_apic.h +@@ -33,42 +33,42 @@ + * The structure of the IO-APIC: + */ + union IO_APIC_reg_00 { +- u32 raw; +- struct __packed { +- u32 __reserved_2 : 14, +- LTS : 1, +- delivery_type : 1, +- __reserved_1 : 8, +- ID : 8; +- } bits; ++ uint32_t raw; ++ struct { ++ unsigned int __reserved_2:14; ++ unsigned int LTS:1; ++ unsigned int delivery_type:1; ++ unsigned int __reserved_1:8; ++ unsigned int ID:8; ++ } bits; + }; + + union IO_APIC_reg_01 { +- u32 raw; +- struct __packed { +- u32 version : 8, +- __reserved_2 : 7, +- PRQ : 1, +- entries : 8, +- __reserved_1 : 8; +- } bits; ++ uint32_t raw; ++ struct { ++ unsigned int version:8; ++ unsigned int __reserved_2:7; ++ unsigned int PRQ:1; ++ unsigned int entries:8; ++ unsigned int __reserved_1:8; ++ } bits; + }; + + union IO_APIC_reg_02 { +- u32 raw; +- struct __packed { +- u32 __reserved_2 : 24, +- arbitration : 4, +- __reserved_1 : 4; +- } bits; ++ uint32_t raw; ++ struct { ++ unsigned int __reserved_2:24; ++ unsigned int arbitration:4; ++ unsigned int __reserved_1:4; ++ } bits; + }; + + union IO_APIC_reg_03 { +- u32 raw; +- struct __packed { +- u32 boot_DT : 1, +- __reserved_1 : 31; +- } bits; ++ uint32_t raw; ++ struct { ++ unsigned int boot_DT:1; ++ unsigned int __reserved_1:31; ++ } bits; + }; + + /* +@@ -88,35 +88,36 @@ enum ioapic_irq_destination_types { + dest_ExtINT = 7 + }; + +-struct __packed IO_APIC_route_entry { +- __u32 vector : 8, +- delivery_mode : 3, /* 000: FIXED +- * 001: lowest prio +- * 111: ExtINT +- */ +- dest_mode : 1, /* 0: physical, 1: logical */ +- delivery_status : 1, +- polarity : 1, +- irr : 1, +- trigger : 1, /* 0: edge, 1: level */ +- mask : 1, /* 0: enabled, 1: disabled */ +- __reserved_2 : 15; +- +- union { struct { __u32 +- __reserved_1 : 24, +- physical_dest : 4, +- __reserved_2 : 4; +- } physical; +- +- struct { __u32 +- __reserved_1 : 24, +- logical_dest : 8; +- } logical; +- +- /* used when Interrupt Remapping with EIM is enabled */ +- __u32 dest32; +- } dest; +- ++struct IO_APIC_route_entry { ++ unsigned int vector:8; ++ unsigned int delivery_mode:3; /* ++ * 000: FIXED ++ * 001: lowest prio ++ * 111: ExtINT ++ */ ++ unsigned int dest_mode:1; /* 0: physical, 1: logical */ ++ unsigned int delivery_status:1; ++ unsigned int polarity:1; /* 0: low, 1: high */ ++ unsigned int irr:1; ++ unsigned int trigger:1; /* 0: edge, 1: level */ ++ unsigned int mask:1; /* 0: enabled, 1: disabled */ ++ unsigned int __reserved_2:15; ++ ++ union { ++ struct { ++ unsigned int __reserved_1:24; ++ unsigned int physical_dest:4; ++ unsigned int __reserved_2:4; ++ } physical; ++ ++ struct { ++ unsigned int __reserved_1:24; ++ unsigned int logical_dest:8; ++ } logical; ++ ++ /* used when Interrupt Remapping with EIM is enabled */ ++ unsigned int dest32; ++ } dest; + }; + + /* diff -Nru xen-4.9.2/debian/patches/gcc-9-snprintf.diff xen-4.9.2/debian/patches/gcc-9-snprintf.diff --- xen-4.9.2/debian/patches/gcc-9-snprintf.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-snprintf.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,43 @@ +From 27751d89248c8c5eef6d8b56eb8f7d2084145080 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Thu, 5 Apr 2018 03:50:50 +0200 +Subject: [PATCH] tools/misc: fix hypothetical buffer overflow in xen-lowmemd +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc-8 complains: + + xen-lowmemd.c: In function 'handle_low_mem': + xen-lowmemd.c:80:55: error: '%s' directive output may be truncated writing up to 511 bytes into a region of size 489 [-Werror=format-truncation=] + snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data); + ^~ ~~~~ + xen-lowmemd.c:80:9: note: 'snprintf' output between 36 and 547 bytes into a destination of size 512 + snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In practice it wouldn't happen, because 'data' contains string +representation of 64-bit unsigned number (20 characters at most). +But place a limit to mute gcc warning. + +Signed-off-by: Marek Marczykowski-Górecki +Acked-by: Wei Liu +Release-Acked-by: Juergen Gross +--- + tools/misc/xen-lowmemd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c +index 865a54cec18..79ad34cb4a2 100644 +--- a/tools/misc/xen-lowmemd.c ++++ b/tools/misc/xen-lowmemd.c +@@ -77,7 +77,7 @@ void handle_low_mem(void) + if (!xs_write(xs_handle, XBT_NULL, + "/local/domain/0/memory/target", data, strlen(data))) + { +- snprintf(error, BUFSZ,"Failed to write target %s to xenstore", data); ++ snprintf(error, BUFSZ,"Failed to write target %.24s to xenstore", data); + perror(error); + } + } diff -Nru xen-4.9.2/debian/patches/gcc-9-strncpy.diff xen-4.9.2/debian/patches/gcc-9-strncpy.diff --- xen-4.9.2/debian/patches/gcc-9-strncpy.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-strncpy.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,41 @@ +From fa7789ef18bd2e716997937af71b2e4b5b00a159 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Thu, 5 Apr 2018 03:50:49 +0200 +Subject: [PATCH] tools/libxc: fix strncpy size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc-8 warns about possible truncation of trailing '\0'. +Final character is overridden by '\0' anyway, so don't bother to copy +it. + +This fixes compile failure: + + xc_pm.c: In function 'xc_set_cpufreq_gov': + xc_pm.c:308:5: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation] + strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + cc1: all warnings being treated as errors + +Signed-off-by: Marek Marczykowski-Górecki +Acked-by: Wei Liu +Release-Acked-by: Juergen Gross +--- + tools/libxc/xc_pm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c +index 67e2418e3f0..6f8d548e44c 100644 +--- a/tools/libxc/xc_pm.c ++++ b/tools/libxc/xc_pm.c +@@ -305,7 +305,7 @@ int xc_set_cpufreq_gov(xc_interface *xch, int cpuid, char *govname) + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV; + sysctl.u.pm_op.cpuid = cpuid; +- strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN); ++ strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN - 1); + scaling_governor[CPUFREQ_NAME_LEN - 1] = '\0'; + + return xc_sysctl(xch, &sysctl); diff -Nru xen-4.9.2/debian/patches/gcc-9-trace.diff xen-4.9.2/debian/patches/gcc-9-trace.diff --- xen-4.9.2/debian/patches/gcc-9-trace.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-trace.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,51 @@ +From 3fd3b266d4198c06e8e421ca515d9ba09ccd5155 Mon Sep 17 00:00:00 2001 +From: Jan Beulich +Date: Mon, 13 May 2019 09:51:23 +0200 +Subject: [PATCH] trace: fix build with gcc9 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +While I've not observed this myself, gcc 9 (imo validly) reportedly may +complain + +trace.c: In function '__trace_hypercall': +trace.c:826:19: error: taking address of packed member of 'struct ' may result in an unaligned pointer value [-Werror=address-of-packed-member] + 826 | uint32_t *a = d.args; + +and the fix is rather simple - remove the __packed attribute. Introduce +a BUILD_BUG_ON() as replacement, for the unlikely case that Xen might +get ported to an architecture where array alignment higher that that of +its elements. + +Reported-by: Martin Liška +Signed-off-by: Jan Beulich +Acked-by: George Dunlap +--- + xen/common/trace.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/xen/common/trace.c b/xen/common/trace.c +index cc294fc3847..d1ef81407b7 100644 +--- a/xen/common/trace.c ++++ b/xen/common/trace.c +@@ -819,12 +819,18 @@ void __trace_var(u32 event, bool_t cycles, unsigned int extra, + void __trace_hypercall(uint32_t event, unsigned long op, + const xen_ulong_t *args) + { +- struct __packed { ++ struct { + uint32_t op; + uint32_t args[6]; + } d; + uint32_t *a = d.args; + ++ /* ++ * In lieu of using __packed above, which gcc9 legitimately doesn't ++ * like in combination with the address of d.args[] taken. ++ */ ++ BUILD_BUG_ON(offsetof(typeof(d), args) != sizeof(d.op)); ++ + #define APPEND_ARG32(i) \ + do { \ + unsigned i_ = (i); \ diff -Nru xen-4.9.2/debian/patches/gcc-9-vwprintw.diff xen-4.9.2/debian/patches/gcc-9-vwprintw.diff --- xen-4.9.2/debian/patches/gcc-9-vwprintw.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-vwprintw.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,33 @@ +From 2b50cdbc444c637575580dcfa6c9525a84d5cc62 Mon Sep 17 00:00:00 2001 +From: Christopher Clark +Date: Wed, 18 Jul 2018 15:22:17 -0700 +Subject: [PATCH] tools/xentop : replace use of deprecated vwprintw + +gcc-8.1 complains: + +| xentop.c: In function 'print': +| xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations] +| vwprintw(stdscr, (curses_str_t)fmt, args); +| ^~~~~~~~ + +vw_printw (note the underscore) is a non-deprecated alternative. + +Signed-off-by: Christopher Clark +Acked-by: Wei Liu +--- + tools/xenstat/xentop/xentop.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c +index 2fd2b6742e6..c46581062bf 100644 +--- a/tools/xenstat/xentop/xentop.c ++++ b/tools/xenstat/xentop/xentop.c +@@ -301,7 +301,7 @@ static void print(const char *fmt, ...) + if (!batch) { + if((current_row() < lines()-1)) { + va_start(args, fmt); +- vwprintw(stdscr, (curses_str_t)fmt, args); ++ vw_printw(stdscr, (curses_str_t)fmt, args); + va_end(args); + } + } else { diff -Nru xen-4.9.2/debian/patches/gcc-9-xenpmd-1.diff xen-4.9.2/debian/patches/gcc-9-xenpmd-1.diff --- xen-4.9.2/debian/patches/gcc-9-xenpmd-1.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-xenpmd-1.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,71 @@ +From 938c8f53b1f80175c6f7a1399efdb984abb0cb8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= + +Date: Thu, 5 Apr 2018 03:50:53 +0200 +Subject: [PATCH] tools/xenpmd: fix possible '\0' truncation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc-8 complains: + xenpmd.c:207:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation] + strncpy(info->oem_info, attrib_value, 32); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + xenpmd.c:201:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation] + strncpy(info->battery_type, attrib_value, 32); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + xenpmd.c:195:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation] + strncpy(info->serial_number, attrib_value, 32); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + xenpmd.c:189:9: error: 'strncpy' specified bound 32 equals destination size [-Werror=stringop-truncation] + strncpy(info->model_number, attrib_value, 32); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Copy 31 chars, then make sure terminating '\0' is present. Those fields +are passed to strlen and as '%s' for snprintf later. + +Signed-off-by: Marek Marczykowski-Górecki +Acked-by: Wei Liu +Release-Acked-by: Juergen Gross +--- + tools/xenpmd/xenpmd.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c +index 689c8fd6702..56412a9a81c 100644 +--- a/tools/xenpmd/xenpmd.c ++++ b/tools/xenpmd/xenpmd.c +@@ -186,25 +186,29 @@ void set_attribute_battery_info(char *attrib_name, + + if ( strstr(attrib_name, "model number") ) + { +- strncpy(info->model_number, attrib_value, 32); ++ strncpy(info->model_number, attrib_value, 31); ++ info->model_number[31] = '\0'; + return; + } + + if ( strstr(attrib_name, "serial number") ) + { +- strncpy(info->serial_number, attrib_value, 32); ++ strncpy(info->serial_number, attrib_value, 31); ++ info->serial_number[31] = '\0'; + return; + } + + if ( strstr(attrib_name, "battery type") ) + { +- strncpy(info->battery_type, attrib_value, 32); ++ strncpy(info->battery_type, attrib_value, 31); ++ info->battery_type[31] = '\0'; + return; + } + + if ( strstr(attrib_name, "OEM info") ) + { +- strncpy(info->oem_info, attrib_value, 32); ++ strncpy(info->oem_info, attrib_value, 31); ++ info->oem_info[31] = '\0'; + return; + } + diff -Nru xen-4.9.2/debian/patches/gcc-9-xenpmd-2.diff xen-4.9.2/debian/patches/gcc-9-xenpmd-2.diff --- xen-4.9.2/debian/patches/gcc-9-xenpmd-2.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/gcc-9-xenpmd-2.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,76 @@ +From e75c9dc85fdeeeda0b98d8cd8d784e0508c3ffb8 Mon Sep 17 00:00:00 2001 +From: Wei Liu +Date: Thu, 26 Jul 2018 15:58:54 +0100 +Subject: [PATCH] xenpmd: make 32 bit gcc 8.1 non-debug build work + +32 bit gcc 8.1 non-debug build yields: + +xenpmd.c:354:23: error: '%02x' directive output may be truncated writing between 2 and 8 bytes into a region of size 3 [-Werror=format-truncation=] + snprintf(val, 3, "%02x", + ^~~~ +xenpmd.c:354:22: note: directive argument in the range [40, 2147483778] + snprintf(val, 3, "%02x", + ^~~~~~ +xenpmd.c:354:5: note: 'snprintf' output between 3 and 9 bytes into a destination of size 3 + snprintf(val, 3, "%02x", + ^~~~~~~~~~~~~~~~~~~~~~~~ + (unsigned int)(9*4 + + ~~~~~~~~~~~~~~~~~~~~ + strlen(info->model_number) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + strlen(info->serial_number) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + strlen(info->battery_type) + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + strlen(info->oem_info) + 4)); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +All info->* used in calculation are 32 bytes long, and the parsing +code makes sure they are null-terminated, so the end result of the +expression won't exceed 255, which should be able to be fit into 3 +bytes in hexadecimal format. + +Add an assertion to make gcc happy. + +Signed-off-by: Wei Liu +Acked-by: Ian Jackson +--- + tools/xenpmd/xenpmd.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c +index 56412a9a81c..1c801caa712 100644 +--- a/tools/xenpmd/xenpmd.c ++++ b/tools/xenpmd/xenpmd.c +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + + /* #define RUN_STANDALONE */ + #define RUN_IN_SIMULATE_MODE +@@ -345,18 +346,17 @@ void write_ulong_lsb_first(char *temp_val, unsigned long val) + void write_battery_info_to_xenstore(struct battery_info *info) + { + char val[1024], string_info[256]; ++ unsigned int len; + + xs_mkdir(xs, XBT_NULL, "/pm"); + + memset(val, 0, 1024); + memset(string_info, 0, 256); + /* write 9 dwords (so 9*4) + length of 4 strings + 4 null terminators */ +- snprintf(val, 3, "%02x", +- (unsigned int)(9*4 + +- strlen(info->model_number) + +- strlen(info->serial_number) + +- strlen(info->battery_type) + +- strlen(info->oem_info) + 4)); ++ len = 9 * 4 + strlen(info->model_number) + strlen(info->serial_number) + ++ strlen(info->battery_type) + strlen(info->oem_info) + 4; ++ assert(len < 255); ++ snprintf(val, 3, "%02x", len); + write_ulong_lsb_first(val+2, info->present); + write_ulong_lsb_first(val+10, info->design_capacity); + write_ulong_lsb_first(val+18, info->last_full_capacity); diff -Nru xen-4.9.2/debian/patches/iasl-201812.diff xen-4.9.2/debian/patches/iasl-201812.diff --- xen-4.9.2/debian/patches/iasl-201812.diff 1970-01-01 00:00:00.000000000 +0000 +++ xen-4.9.2/debian/patches/iasl-201812.diff 2019-10-10 19:07:53.000000000 +0000 @@ -0,0 +1,60 @@ +From 858dbaaeda33b05c1ac80aea0ba9a03924e09005 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= +Date: Wed, 9 May 2018 11:08:12 +0100 +Subject: [PATCH] libacpi: fixes for iasl >= 20180427 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +New versions of iasl have introduced improved C file generation, as +reported in the changelog: + +iASL: Enhanced the -tc option (which creates an AML hex file in C, +suitable for import into a firmware project): + 1) Create a unique name for the table, to simplify use of multiple +SSDTs. + 2) Add a protection #ifdef in the file, similar to a .h header file. + +The net effect of that on generated files is: + +-unsigned char AmlCode[] = ++#ifndef __SSDT_S4_HEX__ ++#define __SSDT_S4_HEX__ ++ ++unsigned char ssdt_s4_aml_code[] = + +The above example is from ssdt_s4.asl. + +Fix the build with newer versions of iasl by stripping the '_aml_code' +suffix from the variable name on generated files. + +Signed-off-by: Roger Pau Monné +Reviewed-by: Wei Liu +Acked-by: Andrew Cooper +Release-acked-by: Juergen Gross +--- + tools/libacpi/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile +index a47a658a255..c17f3924cc3 100644 +--- a/tools/libacpi/Makefile ++++ b/tools/libacpi/Makefile +@@ -43,7 +43,7 @@ all: $(C_SRC) $(H_SRC) + + $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl + iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $< +- sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex >$@ ++ sed -e 's/AmlCode/$*/g' -e 's/_aml_code//g' $(ACPI_BUILD_DIR)/$*.hex >$@ + rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex) + + $(MK_DSDT): mk_dsdt.c +@@ -76,7 +76,7 @@ $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT) + + $(C_SRC): $(ACPI_BUILD_DIR)/%.c: iasl $(ACPI_BUILD_DIR)/%.asl + iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $(ACPI_BUILD_DIR)/$*.asl +- sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex > $@.$(TMP_SUFFIX) ++ sed -e 's/AmlCode/$*/g' -e 's/_aml_code//g' $(ACPI_BUILD_DIR)/$*.hex > $@.$(TMP_SUFFIX) + echo "int $*_len=sizeof($*);" >> $@.$(TMP_SUFFIX) + mv -f $@.$(TMP_SUFFIX) $@ + rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex) diff -Nru xen-4.9.2/debian/patches/series xen-4.9.2/debian/patches/series --- xen-4.9.2/debian/patches/series 2018-04-12 09:54:57.000000000 +0000 +++ xen-4.9.2/debian/patches/series 2019-10-10 19:07:53.000000000 +0000 @@ -47,3 +47,12 @@ ubuntu/local-mce/0012-x86-mce-add-support-of-vLMCE-injection-to-XEN_MC_inj.patch # Security updates +fcf-protection.diff +gcc-9-trace.diff +gcc-9-ioapic.diff +gcc-9-strncpy.diff +gcc-9-snprintf.diff +iasl-201812.diff +gcc-9-vwprintw.diff +gcc-9-xenpmd-1.diff +gcc-9-xenpmd-2.diff