summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei.gherzan@huawei.com>2021-02-20 01:12:55 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-04 17:39:10 (GMT)
commitec6f9694eaea79a264cdf76f6caf82fe8b461e4b (patch)
treedd37449bc4321815a028e3bf9c26518d1a911ec4
parent8db35527ff023413b4fbf0b7ecc524676a80e0ae (diff)
downloadpoky-ec6f9694eaea79a264cdf76f6caf82fe8b461e4b.tar.gz
qemu: Backport patch to avoid assertion fails on icache line size
Due to a bug in glibc 2.33, the value of the icache line size is now reported as unsupported option. This breaks qemu at runtime with: cacheinfo.c:182: init_cache_info: Assertion `(isize & (isize - 1)) == 0' failed. Aborted (core dumped) We haven't caught this one yet because we were already on qemu 5.2.0 when we started to play with glibc 2.33 so it was only reproducible on dunfell. (From OE-Core rev: fdb3ff363c6f8408058f362f3bfdeee4e18150fa) Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
-rw-r--r--meta/recipes-devtools/qemu/qemu/0012-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch48
2 files changed, 49 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 7a963ad..a1a4183 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -28,6 +28,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
28 file://0009-Fix-webkitgtk-builds.patch \ 28 file://0009-Fix-webkitgtk-builds.patch \
29 file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ 29 file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
30 file://0011-hw-i386-pc-fix-regression-in-parsing-vga-cmdline-par.patch \ 30 file://0011-hw-i386-pc-fix-regression-in-parsing-vga-cmdline-par.patch \
31 file://0012-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch \
31 file://CVE-2019-15890.patch \ 32 file://CVE-2019-15890.patch \
32 file://CVE-2020-1711.patch \ 33 file://CVE-2020-1711.patch \
33 file://CVE-2020-7039-1.patch \ 34 file://CVE-2020-7039-1.patch \
diff --git a/meta/recipes-devtools/qemu/qemu/0012-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch b/meta/recipes-devtools/qemu/qemu/0012-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
new file mode 100644
index 0000000..741a4fc
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/0012-util-cacheinfo-fix-crash-when-compiling-with-uClibc.patch
@@ -0,0 +1,48 @@
1From 00b5032eaddb7193f03f0a28b10286244d2e2a7b Mon Sep 17 00:00:00 2001
2From: Carlos Santos <casantos@redhat.com>
3Date: Thu, 17 Oct 2019 09:37:13 -0300
4Subject: [PATCH 1/1] util/cacheinfo: fix crash when compiling with uClibc
5
6uClibc defines _SC_LEVEL1_ICACHE_LINESIZE and _SC_LEVEL1_DCACHE_LINESIZE
7but the corresponding sysconf calls returns -1, which is a valid result,
8meaning that the limit is indeterminate.
9
10Handle this situation using the fallback values instead of crashing due
11to an assertion failure.
12
13Signed-off-by: Carlos Santos <casantos@redhat.com>
14Message-Id: <20191017123713.30192-1-casantos@redhat.com>
15Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
17Upstream-status: Backport
18Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
19---
20 util/cacheinfo.c | 10 ++++++++--
21 1 file changed, 8 insertions(+), 2 deletions(-)
22
23diff --git a/util/cacheinfo.c b/util/cacheinfo.c
24index ea6f3e99bf..d94dc6adc8 100644
25--- a/util/cacheinfo.c
26+++ b/util/cacheinfo.c
27@@ -93,10 +93,16 @@ static void sys_cache_info(int *isize, int *dsize)
28 static void sys_cache_info(int *isize, int *dsize)
29 {
30 # ifdef _SC_LEVEL1_ICACHE_LINESIZE
31- *isize = sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
32+ int tmp_isize = (int) sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
33+ if (tmp_isize > 0) {
34+ *isize = tmp_isize;
35+ }
36 # endif
37 # ifdef _SC_LEVEL1_DCACHE_LINESIZE
38- *dsize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
39+ int tmp_dsize = (int) sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
40+ if (tmp_dsize > 0) {
41+ *dsize = tmp_dsize;
42+ }
43 # endif
44 }
45 #endif /* sys_cache_info */
46--
472.30.1
48