diff options
-rw-r--r-- | recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch (renamed from recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch) | 18 | ||||
-rw-r--r-- | recipes-extended/xen/files/tools-xentop-vwprintw.patch | 25 | ||||
-rw-r--r-- | recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch | 101 | ||||
-rw-r--r-- | recipes-extended/xen/files/xen-disable-sse-before-inlines.patch | 140 | ||||
-rw-r--r-- | recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch | 78 | ||||
-rw-r--r-- | recipes-extended/xen/xen.inc | 14 | ||||
-rw-r--r-- | recipes-extended/xen/xen_4.11.1.bb | 16 | ||||
-rw-r--r-- | recipes-extended/xen/xen_4.12.0.bb | 12 | ||||
-rw-r--r-- | recipes-extended/xen/xen_git.bb | 7 |
9 files changed, 34 insertions, 377 deletions
diff --git a/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch b/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch index 03c39fe7..6504d86e 100644 --- a/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch +++ b/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch | |||
@@ -9,21 +9,20 @@ This is especially useful when the target libdir is not the default one | |||
9 | (/usr/lib), but for example /usr/lib64. | 9 | (/usr/lib), but for example /usr/lib64. |
10 | 10 | ||
11 | Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com> | 11 | Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com> |
12 | --- | 12 | |
13 | tools/pygrub/Makefile | 5 +++-- | 13 | Forward-ported to Xen 4.12.0 |
14 | tools/python/Makefile | 4 ++-- | 14 | Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> |
15 | 2 files changed, 5 insertions(+), 4 deletions(-) | ||
16 | 15 | ||
17 | diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile | 16 | diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile |
18 | index 536af07932b4..e1c773101412 100644 | 17 | index 3063c49..513314b 100644 |
19 | --- a/tools/pygrub/Makefile | 18 | --- a/tools/pygrub/Makefile |
20 | +++ b/tools/pygrub/Makefile | 19 | +++ b/tools/pygrub/Makefile |
21 | @@ -10,14 +10,15 @@ INSTALL_LOG = build/installed_files.txt | 20 | @@ -10,14 +10,15 @@ INSTALL_LOG = build/installed_files.txt |
22 | all: build | 21 | all: build |
23 | .PHONY: build | 22 | .PHONY: build |
24 | build: | 23 | build: |
25 | - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build | 24 | - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build |
26 | + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build $(DISTUTILS_BUILD_ARGS) | 25 | + CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build $(DISTUTILS_BUILD_ARGS) |
27 | 26 | ||
28 | .PHONY: install | 27 | .PHONY: install |
29 | install: all | 28 | install: all |
@@ -37,7 +36,7 @@ index 536af07932b4..e1c773101412 100644 | |||
37 | "`readlink -f $(DESTDIR)/$(bindir)`" != \ | 36 | "`readlink -f $(DESTDIR)/$(bindir)`" != \ |
38 | "`readlink -f $(LIBEXEC_BIN)`" ]; then \ | 37 | "`readlink -f $(LIBEXEC_BIN)`" ]; then \ |
39 | diff --git a/tools/python/Makefile b/tools/python/Makefile | 38 | diff --git a/tools/python/Makefile b/tools/python/Makefile |
40 | index 541858e2f886..4d4a344f1d33 100644 | 39 | index 541858e..4d4a344 100644 |
41 | --- a/tools/python/Makefile | 40 | --- a/tools/python/Makefile |
42 | +++ b/tools/python/Makefile | 41 | +++ b/tools/python/Makefile |
43 | @@ -10,7 +10,7 @@ INSTALL_LOG = build/installed_files.txt | 42 | @@ -10,7 +10,7 @@ INSTALL_LOG = build/installed_files.txt |
@@ -58,6 +57,3 @@ index 541858e2f886..4d4a344f1d33 100644 | |||
58 | 57 | ||
59 | $(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN) | 58 | $(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN) |
60 | $(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN) | 59 | $(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN) |
61 | -- | ||
62 | 2.7.4 | ||
63 | |||
diff --git a/recipes-extended/xen/files/tools-xentop-vwprintw.patch b/recipes-extended/xen/files/tools-xentop-vwprintw.patch deleted file mode 100644 index 5d5d0116..00000000 --- a/recipes-extended/xen/files/tools-xentop-vwprintw.patch +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | tools/xentop : fix vwprintw -Werror=deprecated-declarations warning | ||
2 | |||
3 | gcc-8.1 complains: | ||
4 | |||
5 | | xentop.c: In function 'print': | ||
6 | | xentop.c:304:4: error: 'vwprintw' is deprecated [-Werror=deprecated-declarations] | ||
7 | | vwprintw(stdscr, (curses_str_t)fmt, args); | ||
8 | | ^~~~~~~~ | ||
9 | |||
10 | vw_printw is the non-deprecated alternative. | ||
11 | |||
12 | Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> | ||
13 | diff --git a/tools/xenstat/xentop/xentop.c b/tools/xenstat/xentop/xentop.c | ||
14 | index 2fd2b67..c465810 100644 | ||
15 | --- a/tools/xenstat/xentop/xentop.c | ||
16 | +++ b/tools/xenstat/xentop/xentop.c | ||
17 | @@ -301,7 +301,7 @@ static void print(const char *fmt, ...) | ||
18 | if (!batch) { | ||
19 | if((current_row() < lines()-1)) { | ||
20 | va_start(args, fmt); | ||
21 | - vwprintw(stdscr, (curses_str_t)fmt, args); | ||
22 | + vw_printw(stdscr, (curses_str_t)fmt, args); | ||
23 | va_end(args); | ||
24 | } | ||
25 | } else { | ||
diff --git a/recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch b/recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch deleted file mode 100644 index ece64071..00000000 --- a/recipes-extended/xen/files/xen-4.11-arm-acpi-fix-string-lengths.patch +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | From 5e1a00969afe98a713bf14d1ba1902403b60e287 Mon Sep 17 00:00:00 2001 | ||
2 | From: Christopher Clark <christopher.w.clark@gmail.com> | ||
3 | Date: Thu, 16 Aug 2018 13:04:52 -0700 | ||
4 | Subject: [PATCH v2] libxl/arm: Fix build on arm64 + acpi w/ gcc 8.2 | ||
5 | To: xen-devel@lists.xenproject.org | ||
6 | Cc: wei.liu2@citrix.com, | ||
7 | ian.jackson@eu.citrix.com, | ||
8 | julien.grall@arm.com, | ||
9 | sstabellini@kernel.org | ||
10 | |||
11 | [modified for Xen 4.11 to add required: #include <xen-tools/libs.h>] | ||
12 | |||
13 | Add zero-padding to #defined ACPI table strings that are copied. | ||
14 | Provides sufficient characters to satisfy the length required to | ||
15 | fully populate the destination and prevent array-bounds warnings. | ||
16 | Add BUILD_BUG_ON sizeof checks for compile-time length checking. | ||
17 | |||
18 | Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> | ||
19 | Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> | ||
20 | Acked-by: Wei Liu <wei.liu2@citrix.com> | ||
21 | --- | ||
22 | v2: add BUILD_BUG_ON length checks, requested by Wei. | ||
23 | |||
24 | v1: Please add this patch to the backport list for the next minor | ||
25 | 4.11 release. | ||
26 | |||
27 | Prior to this: gcc 8.2 objects to memcpy past bounds: | ||
28 | |||
29 | | libxl_arm_acpi.c: In function 'make_acpi_header': | ||
30 | | libxl_arm_acpi.c:208:5: error: 'memcpy' forming offset [5, 6] is out | ||
31 | of the bounds [0, 4] [-Werror=array-bounds] | ||
32 | | memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id)); | ||
33 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
34 | | libxl_arm_acpi.c:209:5: error: 'memcpy' forming offset [5, 8] is out | ||
35 | of the bounds [0, 4] [-Werror=array-bounds] | ||
36 | | memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, | ||
37 | sizeof(h->oem_table_id)); | ||
38 | | | ||
39 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
40 | | libxl_arm_acpi.c:211:5: error: 'memcpy' forming offset 4 is out of the | ||
41 | bounds [0, 3] [-Werror=array-bounds] | ||
42 | | memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID, | ||
43 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
44 | | sizeof(h->asl_compiler_id)); | ||
45 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
46 | | In function 'make_acpi_rsdp.isra.4', | ||
47 | | inlined from 'libxl__prepare_acpi' at libxl_arm_acpi.c:389:5: | ||
48 | | libxl_arm_acpi.c:193:5: error: 'memcpy' forming offset [5, 6] is out | ||
49 | of the bounds [0, 4] [-Werror=array-bounds] | ||
50 | | memcpy(rsdp->oem_id, ACPI_OEM_ID, sizeof(rsdp->oem_id)); | ||
51 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
52 | |||
53 | tools/libxl/libxl_arm_acpi.c | 10 +++++++--- | ||
54 | 1 file changed, 7 insertions(+), 3 deletions(-) | ||
55 | |||
56 | diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c | ||
57 | index 636f724..8924396 100644 | ||
58 | --- a/tools/libxl/libxl_arm_acpi.c | ||
59 | +++ b/tools/libxl/libxl_arm_acpi.c | ||
60 | @@ -29,6 +29,7 @@ typedef int64_t s64; | ||
61 | |||
62 | #include <acpi/acconfig.h> | ||
63 | #include <acpi/actbl.h> | ||
64 | +#include <xen-tools/libs.h> | ||
65 | |||
66 | #ifndef BITS_PER_LONG | ||
67 | #ifdef _LP64 | ||
68 | @@ -48,9 +49,9 @@ extern const unsigned char dsdt_anycpu_arm[]; | ||
69 | _hidden | ||
70 | extern const int dsdt_anycpu_arm_len; | ||
71 | |||
72 | -#define ACPI_OEM_ID "Xen" | ||
73 | -#define ACPI_OEM_TABLE_ID "ARM" | ||
74 | -#define ACPI_ASL_COMPILER_ID "XL" | ||
75 | +#define ACPI_OEM_ID "Xen\0\0" | ||
76 | +#define ACPI_OEM_TABLE_ID "ARM\0\0\0\0" | ||
77 | +#define ACPI_ASL_COMPILER_ID "XL\0" | ||
78 | |||
79 | enum { | ||
80 | RSDP, | ||
81 | @@ -190,6 +191,7 @@ static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom, | ||
82 | struct acpi_table_rsdp *rsdp = (void *)dom->acpi_modules[0].data + offset; | ||
83 | |||
84 | memcpy(rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); | ||
85 | + BUILD_BUG_ON(sizeof(ACPI_OEM_ID) != sizeof(rsdp->oem_id)); | ||
86 | memcpy(rsdp->oem_id, ACPI_OEM_ID, sizeof(rsdp->oem_id)); | ||
87 | rsdp->length = acpitables[RSDP].size; | ||
88 | rsdp->revision = 0x02; | ||
89 | @@ -205,9 +207,12 @@ static void make_acpi_header(struct acpi_table_header *h, const char *sig, | ||
90 | memcpy(h->signature, sig, 4); | ||
91 | h->length = len; | ||
92 | h->revision = rev; | ||
93 | + BUILD_BUG_ON(sizeof(ACPI_OEM_ID) != sizeof(h->oem_id)); | ||
94 | memcpy(h->oem_id, ACPI_OEM_ID, sizeof(h->oem_id)); | ||
95 | + BUILD_BUG_ON(sizeof(ACPI_OEM_TABLE_ID) != sizeof(h->oem_table_id)); | ||
96 | memcpy(h->oem_table_id, ACPI_OEM_TABLE_ID, sizeof(h->oem_table_id)); | ||
97 | h->oem_revision = 0; | ||
98 | + BUILD_BUG_ON(sizeof(ACPI_ASL_COMPILER_ID) != sizeof(h->asl_compiler_id)); | ||
99 | memcpy(h->asl_compiler_id, ACPI_ASL_COMPILER_ID, | ||
100 | sizeof(h->asl_compiler_id)); | ||
101 | h->asl_compiler_revision = 0; | ||
diff --git a/recipes-extended/xen/files/xen-disable-sse-before-inlines.patch b/recipes-extended/xen/files/xen-disable-sse-before-inlines.patch deleted file mode 100644 index 54a28ee4..00000000 --- a/recipes-extended/xen/files/xen-disable-sse-before-inlines.patch +++ /dev/null | |||
@@ -1,140 +0,0 @@ | |||
1 | From 6d50ae155c0f736aa6239eabf1bc8c8e3704742d Mon Sep 17 00:00:00 2001 | ||
2 | From: Christopher Clark <christopher.w.clark@gmail.com> | ||
3 | Date: Fri, 21 Sep 2018 08:28:02 -0700 | ||
4 | Subject: [PATCH v2] fuzz, test x86_emulator: disable sse before including | ||
5 | always_inline fns | ||
6 | To: xen-devel@lists.xenproject.org, | ||
7 | jbeulich@suse.com | ||
8 | Cc: ian.jackson@eu.citrix.com, | ||
9 | wei.liu2@citrix.com, | ||
10 | andrew.cooper3@citrix.com | ||
11 | |||
12 | Workaround for compiler rejection of SSE-using always_inlines defined before | ||
13 | SSE is disabled. | ||
14 | |||
15 | Compiling with _FORTIFY_SOURCE or higher levels of optimization enabled | ||
16 | will always_inline several library fns (memset, memcpy, ...) | ||
17 | (with gcc 8.2.0 and glibc 2.28). | ||
18 | |||
19 | In fuzz and x86_emulator test, the compiler is instructed not | ||
20 | to generate SSE instructions via: #pragma GCC target("no-sse") | ||
21 | because those registers are needed for use by the workload. | ||
22 | |||
23 | The combination above causes compilation failure as the inline functions | ||
24 | use those instructions. This is resolved by reordering the inclusion of | ||
25 | <stdio.h> and <string.h> to after the pragma disabling SSE generation. | ||
26 | |||
27 | It would be preferable to locate the no-sse pragma within x86-emulate.h at the | ||
28 | top of the file, prior to including any other headers; unfortunately doing so | ||
29 | before <stdlib.h> causes compilation failure due to declaration of 'atof' with: | ||
30 | "SSE register return with SSE disabled". | ||
31 | Fortunately there is no (known) current dependency on any always_inline | ||
32 | SSE-inclined function declared in <stdlib.h> or any of its dependencies, so the | ||
33 | pragma is therefore issued immediately after inclusion of <stdlib.h> with a | ||
34 | comment introduced to explain its location there. | ||
35 | |||
36 | Add compile-time checks for unwanted prior inclusion of <string.h> and | ||
37 | <stdio.h>, which are the two headers that provide the library functions that | ||
38 | are handled with wrappers and listed within "x86-emulate.h" as ones "we think | ||
39 | might access any of the FPU state". | ||
40 | * Use standard-defined "EOF" macro to detect prior <stdio.h> inclusion. | ||
41 | * Use "_STRING_H" (non-standardized guard macro) as best-effort | ||
42 | for detection of prior <string.h> inclusion. This is non-universally | ||
43 | viable but will provide error output on common GLIBC systems, so | ||
44 | provides some defensive coverage. | ||
45 | |||
46 | Adds conditional #include <stdio.h> to x86-emulate.h because fwrite, printf, | ||
47 | etc. are referenced when WRAP has been defined. | ||
48 | |||
49 | Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> | ||
50 | Reviewed-by: Jan Beulich <jbeulich@suse.com> | ||
51 | --- | ||
52 | tools/fuzz/x86_instruction_emulator/fuzz-emul.c | 10 +++++++-- | ||
53 | tools/tests/x86_emulator/wrappers.c | 1 - | ||
54 | tools/tests/x86_emulator/x86-emulate.h | 28 +++++++++++++++++++++++-- | ||
55 | 3 files changed, 34 insertions(+), 5 deletions(-) | ||
56 | |||
57 | diff --git a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c | ||
58 | index 03a2473..0ffd0fb 100644 | ||
59 | --- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c | ||
60 | +++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c | ||
61 | @@ -6,9 +6,7 @@ | ||
62 | #include <stdbool.h> | ||
63 | #include <stddef.h> | ||
64 | #include <stdint.h> | ||
65 | -#include <stdio.h> | ||
66 | #include <stdlib.h> | ||
67 | -#include <string.h> | ||
68 | #include <sys/types.h> | ||
69 | #include <sys/stat.h> | ||
70 | #include <sys/mman.h> | ||
71 | @@ -16,6 +14,14 @@ | ||
72 | #include <xen/xen.h> | ||
73 | |||
74 | #include "x86-emulate.h" | ||
75 | +/* | ||
76 | + * include "x86-emulate.h" prior to <stdio.h> and <string.h>: | ||
77 | + * x86-emulate.h disables use of SSE registers, while <stdio.h> and <string.h> | ||
78 | + * declare functions that may be always_inline and use those registers | ||
79 | + * unless they have been disabled earlier, which can fail to compile. | ||
80 | + */ | ||
81 | +#include <stdio.h> | ||
82 | +#include <string.h> | ||
83 | #include "fuzz-emul.h" | ||
84 | |||
85 | #define MSR_INDEX_MAX 16 | ||
86 | diff --git a/tools/tests/x86_emulator/wrappers.c b/tools/tests/x86_emulator/wrappers.c | ||
87 | index d02013c..eba7cc9 100644 | ||
88 | --- a/tools/tests/x86_emulator/wrappers.c | ||
89 | +++ b/tools/tests/x86_emulator/wrappers.c | ||
90 | @@ -1,5 +1,4 @@ | ||
91 | #include <stdarg.h> | ||
92 | -#include <stdio.h> | ||
93 | |||
94 | #define WRAP(x) typeof(x) emul_##x | ||
95 | #include "x86-emulate.h" | ||
96 | diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h | ||
97 | index b249e46..07ea1e8 100644 | ||
98 | --- a/tools/tests/x86_emulator/x86-emulate.h | ||
99 | +++ b/tools/tests/x86_emulator/x86-emulate.h | ||
100 | @@ -3,11 +3,35 @@ | ||
101 | #include <stddef.h> | ||
102 | #include <stdint.h> | ||
103 | #include <stdlib.h> | ||
104 | -#include <string.h> | ||
105 | - | ||
106 | +/* | ||
107 | + * Use of sse registers must be disabled prior to the definition of | ||
108 | + * always_inline functions that would use them (memcpy, memset, etc), | ||
109 | + * so do this as early as possible, aiming to be before any always_inline | ||
110 | + * functions that are used are declared. | ||
111 | + * Unfortunately, this cannot be done prior to inclusion of <stdlib.h> | ||
112 | + * due to functions such as 'atof' that have SSE register return declared, | ||
113 | + * so do so here, immediately after that. | ||
114 | + */ | ||
115 | #if __GNUC__ >= 6 | ||
116 | #pragma GCC target("no-sse") | ||
117 | #endif | ||
118 | + /* | ||
119 | + * Attempt detection of unwanted prior inclusion of some headers known to use | ||
120 | + * always_inline with SSE registers in some library / compiler / optimization | ||
121 | + * combinations. | ||
122 | + */ | ||
123 | +#ifdef _STRING_H | ||
124 | +#error "Must not include <string.h> before x86-emulate.h" | ||
125 | +#endif | ||
126 | +#include <string.h> | ||
127 | + | ||
128 | +/* EOF is a standard macro defined in <stdio.h> so use it for detection */ | ||
129 | +#ifdef EOF | ||
130 | +#error "Must not include <stdio.h> before x86-emulate.h" | ||
131 | +#endif | ||
132 | +#ifdef WRAP | ||
133 | +#include <stdio.h> | ||
134 | +#endif | ||
135 | |||
136 | #include <xen/xen.h> | ||
137 | |||
138 | -- | ||
139 | 2.1.4 | ||
140 | |||
diff --git a/recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch b/recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch deleted file mode 100644 index aac7282f..00000000 --- a/recipes-extended/xen/files/xen-tools-xenpmd-snprintf.patch +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | From e4d78a67ffbacf30b66464080898227f18f6bf49 Mon Sep 17 00:00:00 2001 | ||
2 | From: Christopher Clark <christopher.w.clark@gmail.com> | ||
3 | Date: Fri, 17 Aug 2018 17:46:10 -0700 | ||
4 | Subject: [PATCH] xenpmd: prevent format-truncation warning with gcc 8.2 + ARM | ||
5 | 32-bit | ||
6 | To: xen-devel@lists.xenproject.org | ||
7 | Cc: ian.jackson@eu.citrix.com, | ||
8 | wei.liu2@citrix.com | ||
9 | |||
10 | xenpmd writes battery information to xenstore, including a string with a | ||
11 | formatted hex value calculated from summing the lengths of four strings, | ||
12 | plus some constants. | ||
13 | |||
14 | Each of the four strings has a maximum length of 31 bytes, excluding the | ||
15 | terminating zero byte. The strings are stored in 32-byte arrays in a | ||
16 | struct that is zeroed before it is populated, and logic that writes to | ||
17 | the strings uses strncpy and explicit zero termination. | ||
18 | |||
19 | The maximum value to be supplied to the xenstore string is: | ||
20 | (9 * 4) + (31 * 4) + 4 , which is 164, ie. 0xa4. | ||
21 | |||
22 | When used with this value, '%02x' will always fit within 3 bytes, but | ||
23 | gcc 8.2 is apparently not able to deduce this (observed when building | ||
24 | for a 32-bit ARM platform). | ||
25 | |||
26 | This commit assists the compiler by applying a mask (0xff) to the value, | ||
27 | enabling it to observe a lower maximum value and so pass the truncation | ||
28 | length check. | ||
29 | |||
30 | Prior to this change, building fails with the compiler warning: | ||
31 | |||
32 | | xenpmd.c: In function 'write_battery_info_to_xenstore': | ||
33 | | xenpmd.c:354:23: error: '%02x' directive output may be truncated | ||
34 | writing between 2 and 8 bytes into a region of size 3 | ||
35 | [-Werror=format-truncation=] | ||
36 | | snprintf(val, 3, "%02x", | ||
37 | | ^~~~ | ||
38 | | xenpmd.c:354:22: note: directive argument in the range [40, 2147483778] | ||
39 | | snprintf(val, 3, "%02x", | ||
40 | | ^~~~~~ | ||
41 | | xenpmd.c:354:5: note: 'snprintf' output between 3 and 9 bytes into a | ||
42 | destination of size 3 | ||
43 | | snprintf(val, 3, "%02x", | ||
44 | | ^~~~~~~~~~~~~~~~~~~~~~~~ | ||
45 | | (unsigned int)(9*4 + | ||
46 | | ~~~~~~~~~~~~~~~~~~~~ | ||
47 | | strlen(info->model_number) + | ||
48 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
49 | | strlen(info->serial_number) + | ||
50 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
51 | | strlen(info->battery_type) + | ||
52 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
53 | | strlen(info->oem_info) + 4)); | ||
54 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
55 | | cc1: all warnings being treated as errors | ||
56 | |||
57 | Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> | ||
58 | --- | ||
59 | tools/xenpmd/xenpmd.c | 6 ++++-- | ||
60 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
61 | |||
62 | diff --git a/tools/xenpmd/xenpmd.c b/tools/xenpmd/xenpmd.c | ||
63 | index 56412a9..0c0787e 100644 | ||
64 | --- a/tools/xenpmd/xenpmd.c | ||
65 | +++ b/tools/xenpmd/xenpmd.c | ||
66 | @@ -350,8 +350,10 @@ void write_battery_info_to_xenstore(struct battery_info *info) | ||
67 | |||
68 | memset(val, 0, 1024); | ||
69 | memset(string_info, 0, 256); | ||
70 | - /* write 9 dwords (so 9*4) + length of 4 strings + 4 null terminators */ | ||
71 | - snprintf(val, 3, "%02x", | ||
72 | + /* write 9 dwords (so 9*4) + length of 4 strings + 4 null terminators. | ||
73 | + * mask informs the compiler that format truncation will not occur. | ||
74 | + */ | ||
75 | + snprintf(val, 3, "%02x", 0xff & | ||
76 | (unsigned int)(9*4 + | ||
77 | strlen(info->model_number) + | ||
78 | strlen(info->serial_number) + | ||
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc index e29e7f75..b3578240 100644 --- a/recipes-extended/xen/xen.inc +++ b/recipes-extended/xen/xen.inc | |||
@@ -383,13 +383,21 @@ FILES_${PN}-libblktap-dev = " \ | |||
383 | ${datadir}/pkgconfig/blktap.pc \ | 383 | ${datadir}/pkgconfig/blktap.pc \ |
384 | " | 384 | " |
385 | 385 | ||
386 | FILES_${PN}-libfsimage = "${libdir}/libfsimage.so.*" | 386 | FILES_${PN}-libfsimage = " \ |
387 | ${libdir}/libfsimage.so.* \ | ||
388 | ${libdir}/libxenfsimage.so.* \ | ||
389 | " | ||
387 | FILES_${PN}-libfsimage-dev = " \ | 390 | FILES_${PN}-libfsimage-dev = " \ |
388 | ${libdir}/libfsimage.so \ | 391 | ${libdir}/libfsimage.so \ |
392 | ${libdir}/libxenfsimage.so \ | ||
389 | ${datadir}/pkgconfig/fsimage.pc \ | 393 | ${datadir}/pkgconfig/fsimage.pc \ |
394 | ${datadir}/pkgconfig/xenfsimage.pc \ | ||
390 | " | 395 | " |
391 | 396 | ||
392 | FILES_${PN}-fsimage = "${libdir}/fs/*/*fsimage.so" | 397 | FILES_${PN}-fsimage = " \ |
398 | ${libdir}/fs/*/*fsimage.so \ | ||
399 | ${libdir}/xenfsimage/*/fsimage.so \ | ||
400 | " | ||
393 | 401 | ||
394 | FILES_${PN}-hypervisor = "\ | 402 | FILES_${PN}-hypervisor = "\ |
395 | /boot/xen-* \ | 403 | /boot/xen-* \ |
@@ -466,6 +474,7 @@ FILES_${PN}-hvmloader = "\ | |||
466 | 474 | ||
467 | FILES_${PN}-kdd = "\ | 475 | FILES_${PN}-kdd = "\ |
468 | ${sbindir}/kdd \ | 476 | ${sbindir}/kdd \ |
477 | ${sbindir}/xen-kdd \ | ||
469 | " | 478 | " |
470 | 479 | ||
471 | FILES_${PN}-livepatch += " \ | 480 | FILES_${PN}-livepatch += " \ |
@@ -738,6 +747,7 @@ FILES_${PN}-xenmon = "\ | |||
738 | ${sbindir}/xenbaked \ | 747 | ${sbindir}/xenbaked \ |
739 | ${sbindir}/xentrace_setmask \ | 748 | ${sbindir}/xentrace_setmask \ |
740 | ${sbindir}/xenmon.py \ | 749 | ${sbindir}/xenmon.py \ |
750 | ${sbindir}/xenmon \ | ||
741 | " | 751 | " |
742 | 752 | ||
743 | FILES_${PN}-xm = "\ | 753 | FILES_${PN}-xm = "\ |
diff --git a/recipes-extended/xen/xen_4.11.1.bb b/recipes-extended/xen/xen_4.11.1.bb deleted file mode 100644 index fea17a78..00000000 --- a/recipes-extended/xen/xen_4.11.1.bb +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
2 | require xen.inc | ||
3 | |||
4 | SRC_URI = " \ | ||
5 | https://downloads.xenproject.org/release/xen/${PV}/xen-${PV}.tar.gz \ | ||
6 | file://tools-xentop-vwprintw.patch \ | ||
7 | file://xen-4.11-arm-acpi-fix-string-lengths.patch \ | ||
8 | file://xen-tools-xenpmd-snprintf.patch \ | ||
9 | file://xen-disable-sse-before-inlines.patch \ | ||
10 | file://0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch \ | ||
11 | " | ||
12 | |||
13 | SRC_URI[md5sum] = "0c72b97432465e7f81113630fcd6e460" | ||
14 | SRC_URI[sha256sum] = "be88cb2443761990efc1070d9718016561fe19066af232f9bfae572922897e59" | ||
15 | |||
16 | S = "${WORKDIR}/xen-${PV}" | ||
diff --git a/recipes-extended/xen/xen_4.12.0.bb b/recipes-extended/xen/xen_4.12.0.bb new file mode 100644 index 00000000..246be7a0 --- /dev/null +++ b/recipes-extended/xen/xen_4.12.0.bb | |||
@@ -0,0 +1,12 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
2 | require xen.inc | ||
3 | |||
4 | SRC_URI = " \ | ||
5 | https://downloads.xenproject.org/release/xen/${PV}/xen-${PV}.tar.gz \ | ||
6 | file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \ | ||
7 | " | ||
8 | |||
9 | SRC_URI[md5sum] = "7d24d4541e3025421e02384cabc3528b" | ||
10 | SRC_URI[sha256sum] = "6e5455e4a58dcb2339bfcd2a89842728068b530aa62501843793f7cf743c4d64" | ||
11 | |||
12 | S = "${WORKDIR}/xen-${PV}" | ||
diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb index 0ebd81ce..5f950e6f 100644 --- a/recipes-extended/xen/xen_git.bb +++ b/recipes-extended/xen/xen_git.bb | |||
@@ -1,8 +1,8 @@ | |||
1 | require xen.inc | 1 | require xen.inc |
2 | 2 | ||
3 | SRCREV ?= "2b50cdbc444c637575580dcfa6c9525a84d5cc62" | 3 | SRCREV ?= "cb70a26f78848fe45f593f7ebc9cfaac760a791b" |
4 | 4 | ||
5 | XEN_REL = "4.12" | 5 | XEN_REL = "4.13" |
6 | XEN_BRANCH = "staging" | 6 | XEN_BRANCH = "staging" |
7 | FLASK_POLICY_FILE = "xenpolicy-${XEN_REL}-unstable" | 7 | FLASK_POLICY_FILE = "xenpolicy-${XEN_REL}-unstable" |
8 | 8 | ||
@@ -12,8 +12,7 @@ S = "${WORKDIR}/git" | |||
12 | 12 | ||
13 | SRC_URI = " \ | 13 | SRC_URI = " \ |
14 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ | 14 | git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ |
15 | file://xen-disable-sse-before-inlines.patch \ | 15 | file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \ |
16 | file://0001-python-pygrub-pass-DISTUTILS-env-vars-as-setup.py-ar.patch \ | ||
17 | " | 16 | " |
18 | 17 | ||
19 | DEFAULT_PREFERENCE = "-1" | 18 | DEFAULT_PREFERENCE = "-1" |