From 5a308c55a60282b475545f3c7346e5e8053aba3f Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Tue, 20 Aug 2019 13:59:15 -0700 Subject: qemu: Upgrade to version 4.1 (From OE-Core rev: 50a7dec95618080962e56fd347f505e691b7ad6f) Signed-off-by: Alistair Francis Signed-off-by: Richard Purdie --- meta/conf/distro/include/tcmode-default.inc | 2 +- meta/recipes-devtools/qemu/qemu-native.inc | 4 +- meta/recipes-devtools/qemu/qemu-native_4.0.0.bb | 9 - meta/recipes-devtools/qemu/qemu-native_4.1.0.bb | 9 + .../qemu/qemu-system-native_4.0.0.bb | 24 -- .../qemu/qemu-system-native_4.1.0.bb | 24 ++ meta/recipes-devtools/qemu/qemu.inc | 20 +- ...001-qemu-Add-missing-wacom-HID-descriptor.patch | 10 +- ...age-ptest-which-runs-all-unit-test-cases-.patch | 6 +- ...dition-environment-space-to-boot-loader-q.patch | 4 +- .../qemu/qemu/0004-qemu-disable-Valgrind.patch | 6 +- ...paths-searched-during-user-mode-emulation.patch | 146 --------- ...-set-ld.bfd-fix-cflags-and-set-some-envir.patch | 26 ++ ...ardev-connect-socket-to-a-spawned-command.patch | 239 +++++++++++++++ ...-set-ld.bfd-fix-cflags-and-set-some-envir.patch | 26 -- .../qemu/0007-apic-fixup-fallthrough-to-PIC.patch | 44 +++ ...ardev-connect-socket-to-a-spawned-command.patch | 239 --------------- .../qemu/0008-apic-fixup-fallthrough-to-PIC.patch | 44 --- ...-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch | 33 ++ .../qemu/qemu/0009-Fix-webkitgtk-builds.patch | 137 +++++++++ ...-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch | 33 -- ...x-user-fix-mmap-munmap-mprotect-mremap-sh.patch | 142 --------- ...10-fix-libcap-header-issue-on-some-distro.patch | 86 ++++++ ...error-messages-when-qemi_cpu_kick_thread-.patch | 74 +++++ ...11-fix-libcap-header-issue-on-some-distro.patch | 86 ------ ...error-messages-when-qemi_cpu_kick_thread-.patch | 74 ----- ...-target-arm-Fix-vector-operation-segfault.patch | 66 ---- ...fix-to-handle-variably-sized-SIOCGSTAMP-w.patch | 339 --------------------- .../qemu/qemu/CVE-2019-12155.patch | 35 --- meta/recipes-devtools/qemu/qemu_4.0.0.bb | 21 -- meta/recipes-devtools/qemu/qemu_4.1.0.bb | 21 ++ 31 files changed, 717 insertions(+), 1312 deletions(-) delete mode 100644 meta/recipes-devtools/qemu/qemu-native_4.0.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu-native_4.1.0.bb delete mode 100644 meta/recipes-devtools/qemu/qemu-system-native_4.0.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu-system-native_4.1.0.bb delete mode 100644 meta/recipes-devtools/qemu/qemu/0005-qemu-Limit-paths-searched-during-user-mode-emulation.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0005-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0006-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0007-apic-fixup-fallthrough-to-PIC.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0007-chardev-connect-socket-to-a-spawned-command.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0008-apic-fixup-fallthrough-to-PIC.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0009-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0010-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0010-fix-libcap-header-issue-on-some-distro.patch create mode 100644 meta/recipes-devtools/qemu/qemu/0011-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0011-fix-libcap-header-issue-on-some-distro.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0012-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0013-target-arm-Fix-vector-operation-segfault.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch delete mode 100644 meta/recipes-devtools/qemu/qemu/CVE-2019-12155.patch delete mode 100644 meta/recipes-devtools/qemu/qemu_4.0.0.bb create mode 100644 meta/recipes-devtools/qemu/qemu_4.1.0.bb (limited to 'meta') diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc index 1966dbd521..c89b8e012d 100644 --- a/meta/conf/distro/include/tcmode-default.inc +++ b/meta/conf/distro/include/tcmode-default.inc @@ -24,7 +24,7 @@ BINUVERSION ?= "2.32%" GDBVERSION ?= "8.3%" GLIBCVERSION ?= "2.30%" LINUXLIBCVERSION ?= "5.0%" -QEMUVERSION ?= "4.0%" +QEMUVERSION ?= "4.1%" GOVERSION ?= "1.12%" # This can not use wildcards like 8.0.% since it is also used in mesa to denote # llvm version being used, so always bump it with llvm recipe version bump diff --git a/meta/recipes-devtools/qemu/qemu-native.inc b/meta/recipes-devtools/qemu/qemu-native.inc index c04297cad0..69c2c43e6b 100644 --- a/meta/recipes-devtools/qemu/qemu-native.inc +++ b/meta/recipes-devtools/qemu/qemu-native.inc @@ -3,8 +3,8 @@ inherit native require qemu.inc SRC_URI_append = " \ - file://0011-fix-libcap-header-issue-on-some-distro.patch \ - file://0012-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch \ + file://0010-fix-libcap-header-issue-on-some-distro.patch \ + file://0011-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch \ " EXTRA_OEMAKE_append = " LD='${LD}' AR='${AR}' OBJCOPY='${OBJCOPY}' LDFLAGS='${LDFLAGS}'" diff --git a/meta/recipes-devtools/qemu/qemu-native_4.0.0.bb b/meta/recipes-devtools/qemu/qemu-native_4.0.0.bb deleted file mode 100644 index c8acff8e19..0000000000 --- a/meta/recipes-devtools/qemu/qemu-native_4.0.0.bb +++ /dev/null @@ -1,9 +0,0 @@ -BPN = "qemu" - -DEPENDS = "glib-2.0-native zlib-native" - -require qemu-native.inc - -EXTRA_OECONF_append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" - -PACKAGECONFIG ??= "" diff --git a/meta/recipes-devtools/qemu/qemu-native_4.1.0.bb b/meta/recipes-devtools/qemu/qemu-native_4.1.0.bb new file mode 100644 index 0000000000..c8acff8e19 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-native_4.1.0.bb @@ -0,0 +1,9 @@ +BPN = "qemu" + +DEPENDS = "glib-2.0-native zlib-native" + +require qemu-native.inc + +EXTRA_OECONF_append = " --target-list=${@get_qemu_usermode_target_list(d)} --disable-tools --disable-blobs --disable-guest-agent" + +PACKAGECONFIG ??= "" diff --git a/meta/recipes-devtools/qemu/qemu-system-native_4.0.0.bb b/meta/recipes-devtools/qemu/qemu-system-native_4.0.0.bb deleted file mode 100644 index 964dcee524..0000000000 --- a/meta/recipes-devtools/qemu/qemu-system-native_4.0.0.bb +++ /dev/null @@ -1,24 +0,0 @@ -BPN = "qemu" - -require qemu-native.inc - -# As some of the files installed by qemu-native and qemu-system-native -# are the same, we depend on qemu-native to get the full installation set -# and avoid file clashes -DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native" - -EXTRA_OECONF_append = " --target-list=${@get_qemu_system_target_list(d)}" - -PACKAGECONFIG ??= "fdt alsa kvm" - -# Handle distros such as CentOS 5 32-bit that do not have kvm support -PACKAGECONFIG_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" - -do_install_append() { - install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu - - # The following is also installed by qemu-native - rm -f ${D}${datadir}/qemu/trace-events-all - rm -rf ${D}${datadir}/qemu/keymaps - rm -rf ${D}${datadir}/icons/ -} diff --git a/meta/recipes-devtools/qemu/qemu-system-native_4.1.0.bb b/meta/recipes-devtools/qemu/qemu-system-native_4.1.0.bb new file mode 100644 index 0000000000..d83ee59375 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu-system-native_4.1.0.bb @@ -0,0 +1,24 @@ +BPN = "qemu" + +require qemu-native.inc + +# As some of the files installed by qemu-native and qemu-system-native +# are the same, we depend on qemu-native to get the full installation set +# and avoid file clashes +DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native" + +EXTRA_OECONF_append = " --target-list=${@get_qemu_system_target_list(d)}" + +PACKAGECONFIG ??= "fdt alsa kvm" + +# Handle distros such as CentOS 5 32-bit that do not have kvm support +PACKAGECONFIG_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}" + +do_install_append() { + install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu + + # The following is also installed by qemu-native + rm -f ${D}${datadir}/qemu/trace-events-all + rm -rf ${D}${datadir}/qemu/keymaps + rm -rf ${D}${datadir}/icons/ +} diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index 46c40b7d4f..d2dd2bc9c1 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc @@ -17,20 +17,16 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0002-Add-subpackage-ptest-which-runs-all-unit-test-cases-.patch \ file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ file://0004-qemu-disable-Valgrind.patch \ - file://0005-qemu-Limit-paths-searched-during-user-mode-emulation.patch \ - file://0006-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch \ - file://0007-chardev-connect-socket-to-a-spawned-command.patch \ - file://0008-apic-fixup-fallthrough-to-PIC.patch \ - file://0009-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ - file://0010-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch \ - file://0013-target-arm-Fix-vector-operation-segfault.patch \ - file://0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch \ - file://CVE-2019-12155.patch \ + file://0005-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch \ + file://0006-chardev-connect-socket-to-a-spawned-command.patch \ + file://0007-apic-fixup-fallthrough-to-PIC.patch \ + file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ + file://0009-Fix-webkitgtk-builds.patch \ " UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar" -SRC_URI[md5sum] = "0afeca336fd57ae3d3086ec07f59d708" -SRC_URI[sha256sum] = "13a93dfe75b86734326f8d5b475fde82ec692d5b5a338b4262aeeb6b0fa4e469" +SRC_URI[md5sum] = "cdf2b5ca52b9abac9bacb5842fa420f8" +SRC_URI[sha256sum] = "656e60218689bdeec69903087fd7582d5d3e72238d02f4481d8dc6d79fd909c6" COMPATIBLE_HOST_mipsarchn32 = "null" COMPATIBLE_HOST_mipsarchn64 = "null" @@ -141,7 +137,7 @@ PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," -PACKAGECONFIG[ssh2] = "--enable-libssh2,--disable-libssh2,libssh2," +PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" diff --git a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch index 5373915ff0..9478102ae5 100644 --- a/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch +++ b/meta/recipes-devtools/qemu/qemu/0001-qemu-Add-missing-wacom-HID-descriptor.patch @@ -1,4 +1,4 @@ -From 1cb804cf0e47116202011f3386b4739af668224a Mon Sep 17 00:00:00 2001 +From 4655dc18074e0be9d239f51dac32b61435da8549 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 27 Nov 2014 14:04:29 +0000 Subject: [PATCH] qemu: Add missing wacom HID descriptor @@ -19,10 +19,10 @@ Upstream-Status: Submitted 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-wacom.c b/hw/usb/dev-wacom.c -index ac0bc83b..6f9b22d4 100644 +index 8c43db93..3ff8ca28 100644 --- a/hw/usb/dev-wacom.c +++ b/hw/usb/dev-wacom.c -@@ -72,6 +72,89 @@ static const USBDescStrings desc_strings = { +@@ -74,6 +74,89 @@ static const USBDescStrings desc_strings = { [STR_SERIALNUMBER] = "1", }; @@ -112,7 +112,7 @@ index ac0bc83b..6f9b22d4 100644 static const USBDescIface desc_iface_wacom = { .bInterfaceNumber = 0, .bNumEndpoints = 1, -@@ -89,7 +172,7 @@ static const USBDescIface desc_iface_wacom = { +@@ -91,7 +174,7 @@ static const USBDescIface desc_iface_wacom = { 0x00, /* u8 country_code */ 0x01, /* u8 num_descriptors */ 0x22, /* u8 type: Report */ @@ -121,7 +121,7 @@ index ac0bc83b..6f9b22d4 100644 }, }, }, -@@ -269,6 +352,15 @@ static void usb_wacom_handle_control(USBDevice *dev, USBPacket *p, +@@ -271,6 +354,15 @@ static void usb_wacom_handle_control(USBDevice *dev, USBPacket *p, } switch (request) { diff --git a/meta/recipes-devtools/qemu/qemu/0002-Add-subpackage-ptest-which-runs-all-unit-test-cases-.patch b/meta/recipes-devtools/qemu/qemu/0002-Add-subpackage-ptest-which-runs-all-unit-test-cases-.patch index 7b7c5d71a0..2ccddd53cf 100644 --- a/meta/recipes-devtools/qemu/qemu/0002-Add-subpackage-ptest-which-runs-all-unit-test-cases-.patch +++ b/meta/recipes-devtools/qemu/qemu/0002-Add-subpackage-ptest-which-runs-all-unit-test-cases-.patch @@ -1,4 +1,4 @@ -From 281116b31981b0b9e174bda8abe00f4eaa33c2ae Mon Sep 17 00:00:00 2001 +From 67751f3a23e3db3012f391b3b3b73a4484488ce9 Mon Sep 17 00:00:00 2001 From: Juro Bystricky Date: Thu, 31 Aug 2017 11:06:56 -0700 Subject: [PATCH] Add subpackage -ptest which runs all unit test cases for @@ -15,10 +15,10 @@ Signed-off-by: Juro Bystricky 1 file changed, 8 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include -index 36fc73fe..01fecd4d 100644 +index fd7fdb86..83b7f409 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include -@@ -1184,4 +1184,12 @@ all: $(QEMU_IOTESTS_HELPERS-y) +@@ -1183,4 +1183,12 @@ all: $(QEMU_IOTESTS_HELPERS-y) -include $(wildcard tests/*.d) -include $(wildcard tests/libqos/*.d) diff --git a/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch b/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch index 9a18ca18e4..5c42d68030 100644 --- a/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch +++ b/meta/recipes-devtools/qemu/qemu/0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch @@ -1,4 +1,4 @@ -From bf04acef9ec31ddcc18ddbb4ac5b7b1e7368bf7d Mon Sep 17 00:00:00 2001 +From 235b94f1188597873c8776b019fed49947983392 Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Fri, 28 Mar 2014 17:42:43 +0800 Subject: [PATCH] qemu: Add addition environment space to boot loader @@ -19,7 +19,7 @@ Signed-off-by: Roy Li 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c -index 439665ab..285c78ef 100644 +index 20e019bf..d150b01c 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -60,7 +60,7 @@ diff --git a/meta/recipes-devtools/qemu/qemu/0004-qemu-disable-Valgrind.patch b/meta/recipes-devtools/qemu/qemu/0004-qemu-disable-Valgrind.patch index 9e326081f2..0ac4ab40b1 100644 --- a/meta/recipes-devtools/qemu/qemu/0004-qemu-disable-Valgrind.patch +++ b/meta/recipes-devtools/qemu/qemu/0004-qemu-disable-Valgrind.patch @@ -1,4 +1,4 @@ -From e40f797548bc3ff06c71b6cbe042a46406894d18 Mon Sep 17 00:00:00 2001 +From 3ad7a375015d47fdf5016e03e11fa93440d6d8bd Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 20 Oct 2015 22:19:08 +0100 Subject: [PATCH] qemu: disable Valgrind @@ -13,10 +13,10 @@ Signed-off-by: Ross Burton 1 file changed, 9 deletions(-) diff --git a/configure b/configure -index 1c563a70..eaf9bb5e 100755 +index 714e7fb6..dad4fc59 100755 --- a/configure +++ b/configure -@@ -5311,15 +5311,6 @@ fi +@@ -5335,15 +5335,6 @@ fi # check if we have valgrind/valgrind.h valgrind_h=no diff --git a/meta/recipes-devtools/qemu/qemu/0005-qemu-Limit-paths-searched-during-user-mode-emulation.patch b/meta/recipes-devtools/qemu/qemu/0005-qemu-Limit-paths-searched-during-user-mode-emulation.patch deleted file mode 100644 index 819720a3f2..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0005-qemu-Limit-paths-searched-during-user-mode-emulation.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 547c3710a1493d2fd6bb56b819cf162db433756a Mon Sep 17 00:00:00 2001 -From: Richard Purdie -Date: Wed, 9 Mar 2016 22:49:02 +0000 -Subject: [PATCH] qemu: Limit paths searched during user mode emulation - -By default qemu builds a complete list of directories within the user -emulation sysroot (-L option). The OE sysroot directory is large and -this is confusing, for example it indexes all pkgdata. In particular this -confuses strace of qemu binaries with tons of irrelevant paths. - -This patch stops the code indexing up front and instead only indexes -things if/as/when it needs to. This drastically reduces the files it -reads and reduces memory usage and cleans up strace. - -It would also avoid the infinite directory traversal bug in [YOCTO #6996] -although the code could still be vulnerable if it parsed those specific -paths. - -RP -2016/3/9 -Upstream-Status: Pending - ---- - util/path.c | 44 ++++++++++++++++++++++---------------------- - 1 file changed, 22 insertions(+), 22 deletions(-) - -diff --git a/util/path.c b/util/path.c -index 7f9fc272..a416cd4a 100644 ---- a/util/path.c -+++ b/util/path.c -@@ -15,6 +15,7 @@ struct pathelem - char *name; - /* Full path name, eg. /usr/gnemul/x86-linux/lib. */ - char *pathname; -+ int populated_entries; - struct pathelem *parent; - /* Children */ - unsigned int num_entries; -@@ -45,6 +46,7 @@ static struct pathelem *new_entry(const char *root, - new->name = g_strdup(name); - new->pathname = g_strdup_printf("%s/%s", root, name); - new->num_entries = 0; -+ new->populated_entries = 0; - return new; - } - -@@ -53,15 +55,16 @@ static struct pathelem *new_entry(const char *root, - /* Not all systems provide this feature */ - #if defined(DT_DIR) && defined(DT_UNKNOWN) && defined(DT_LNK) - # define dirent_type(dirent) ((dirent)->d_type) --# define is_dir_maybe(type) \ -- ((type) == DT_DIR || (type) == DT_UNKNOWN || (type) == DT_LNK) -+# define is_not_dir(type) \ -+ ((type) != DT_DIR && (type) != DT_UNKNOWN && (type) != DT_LNK) - #else - # define dirent_type(dirent) (1) --# define is_dir_maybe(type) (type) -+# define is_not_dir(type) (0) - #endif - - static struct pathelem *add_dir_maybe(struct pathelem *path) - { -+ unsigned int i; - DIR *dir; - - if ((dir = opendir(path->pathname)) != NULL) { -@@ -74,6 +77,11 @@ static struct pathelem *add_dir_maybe(struct pathelem *path) - } - closedir(dir); - } -+ -+ for (i = 0; i < path->num_entries; i++) -+ (path->entries[i])->parent = path; -+ -+ path->populated_entries = 1; - return path; - } - -@@ -89,26 +97,16 @@ static struct pathelem *add_entry(struct pathelem *root, const char *name, - e = &root->entries[root->num_entries-1]; - - *e = new_entry(root->pathname, root, name); -- if (is_dir_maybe(type)) { -- *e = add_dir_maybe(*e); -+ if (is_not_dir(type)) { -+ (*e)->populated_entries = 1; - } - - return root; - } - --/* This needs to be done after tree is stabilized (ie. no more reallocs!). */ --static void set_parents(struct pathelem *child, struct pathelem *parent) --{ -- unsigned int i; -- -- child->parent = parent; -- for (i = 0; i < child->num_entries; i++) -- set_parents(child->entries[i], child); --} -- - /* FIXME: Doesn't handle DIR/.. where DIR is not in emulated dir. */ - static const char * --follow_path(const struct pathelem *cursor, const char *name) -+follow_path(struct pathelem *cursor, struct pathelem **source, const char *name) - { - unsigned int i, namelen; - -@@ -119,14 +117,18 @@ follow_path(const struct pathelem *cursor, const char *name) - return cursor->pathname; - - if (strneq(name, namelen, "..")) -- return follow_path(cursor->parent, name + namelen); -+ return follow_path(cursor->parent, &cursor->parent, name + namelen); - - if (strneq(name, namelen, ".")) -- return follow_path(cursor, name + namelen); -+ return follow_path(cursor, source, name + namelen); -+ -+ if (!cursor->populated_entries) -+ *source = add_dir_maybe(cursor); -+ cursor = *source; - - for (i = 0; i < cursor->num_entries; i++) - if (strneq(name, namelen, cursor->entries[i]->name)) -- return follow_path(cursor->entries[i], name + namelen); -+ return follow_path(cursor->entries[i], &cursor->entries[i], name + namelen); - - /* Not found */ - return NULL; -@@ -160,8 +162,6 @@ void init_paths(const char *prefix) - g_free(base->name); - g_free(base); - base = NULL; -- } else { -- set_parents(base, base); - } - } - -@@ -173,5 +173,5 @@ const char *path(const char *name) - if (!base || !name || name[0] != '/') - return name; - -- return follow_path(base, name) ?: name; -+ return follow_path(base, &base, name) ?: name; - } diff --git a/meta/recipes-devtools/qemu/qemu/0005-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch b/meta/recipes-devtools/qemu/qemu/0005-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch new file mode 100644 index 0000000000..a73681510e --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0005-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch @@ -0,0 +1,26 @@ +From 80e6070bcdfe636b103a13598e6c38ad0d0e7624 Mon Sep 17 00:00:00 2001 +From: Stephen Arnold +Date: Sun, 12 Jun 2016 18:09:56 -0700 +Subject: [PATCH] qemu-native: set ld.bfd, fix cflags, and set some environment + +Upstream-Status: Pending + +--- + configure | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/configure b/configure +index dad4fc59..685bbe5e 100755 +--- a/configure ++++ b/configure +@@ -5971,10 +5971,6 @@ write_c_skeleton + if test "$gcov" = "yes" ; then + CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" + LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" +-elif test "$fortify_source" = "yes" ; then +- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" +-elif test "$debug" = "no"; then +- CFLAGS="-O2 $CFLAGS" + fi + + if test "$have_asan" = "yes"; then diff --git a/meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch b/meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch new file mode 100644 index 0000000000..a42385530f --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0006-chardev-connect-socket-to-a-spawned-command.patch @@ -0,0 +1,239 @@ +From ad853601e75f6d0dd09672bcca05fbe4fac766a4 Mon Sep 17 00:00:00 2001 +From: Alistair Francis +Date: Thu, 21 Dec 2017 11:35:16 -0800 +Subject: [PATCH] chardev: connect socket to a spawned command + +The command is started in a shell (sh -c) with stdin connect to QEMU +via a Unix domain stream socket. QEMU then exchanges data via its own +end of the socket, just like it normally does. + +"-chardev socket" supports some ways of connecting via protocols like +telnet, but that is only a subset of the functionality supported by +tools socat. To use socat instead, for example to connect via a socks +proxy, use: + + -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ + -device usb-serial,chardev=socat + +Beware that commas in the command must be escaped as double commas. + +Or interactively in the console: + (qemu) chardev-add socket,id=cat,cmd=cat + (qemu) device_add usb-serial,chardev=cat + ^ac + # cat >/dev/ttyUSB0 + hello + hello + +Another usage is starting swtpm from inside QEMU. swtpm will +automatically shut down once it looses the connection to the parent +QEMU, so there is no risk of lingering processes: + + -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ + -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ + -device tpm-tis,tpmdev=tpm0 + +The patch was discussed upstream, but QEMU developers believe that the +code calling QEMU should be responsible for managing additional +processes. In OE-core, that would imply enhancing runqemu and +oeqa. This patch is a simpler solution. + +Because it is not going upstream, the patch was written so that it is +as simple as possible. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Patrick Ohly + +--- + chardev/char-socket.c | 101 ++++++++++++++++++++++++++++++++++++++++++ + chardev/char.c | 3 ++ + qapi/char.json | 5 +++ + 3 files changed, 109 insertions(+) + +diff --git a/chardev/char-socket.c b/chardev/char-socket.c +index 7ca5d97a..207fae4a 100644 +--- a/chardev/char-socket.c ++++ b/chardev/char-socket.c +@@ -1278,6 +1278,67 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, + return true; + } + ++#ifndef _WIN32 ++static void chardev_open_socket_cmd(Chardev *chr, ++ const char *cmd, ++ Error **errp) ++{ ++ int fds[2] = { -1, -1 }; ++ QIOChannelSocket *sioc = NULL; ++ pid_t pid = -1; ++ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; ++ ++ /* ++ * We need a Unix domain socket for commands like swtpm and a single ++ * connection, therefore we cannot use qio_channel_command_new_spawn() ++ * without patching it first. Duplicating the functionality is easier. ++ */ ++ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { ++ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); ++ goto error; ++ } ++ ++ pid = qemu_fork(errp); ++ if (pid < 0) { ++ goto error; ++ } ++ ++ if (!pid) { ++ /* child */ ++ dup2(fds[1], STDIN_FILENO); ++ execv(argv[0], (char * const *)argv); ++ _exit(1); ++ } ++ ++ /* ++ * Hand over our end of the socket pair to the qio channel. ++ * ++ * We don't reap the child because it is expected to keep ++ * running. We also don't support the "reconnect" option for the ++ * same reason. ++ */ ++ sioc = qio_channel_socket_new_fd(fds[0], errp); ++ if (!sioc) { ++ goto error; ++ } ++ fds[0] = -1; ++ ++ g_free(chr->filename); ++ chr->filename = g_strdup_printf("cmd:%s", cmd); ++ tcp_chr_new_client(chr, sioc); ++ ++ error: ++ if (fds[0] >= 0) { ++ close(fds[0]); ++ } ++ if (fds[1] >= 0) { ++ close(fds[1]); ++ } ++ if (sioc) { ++ object_unref(OBJECT(sioc)); ++ } ++} ++#endif + + static void qmp_chardev_open_socket(Chardev *chr, + ChardevBackend *backend, +@@ -1286,6 +1347,9 @@ static void qmp_chardev_open_socket(Chardev *chr, + { + SocketChardev *s = SOCKET_CHARDEV(chr); + ChardevSocket *sock = backend->u.socket.data; ++#ifndef _WIN32 ++ const char *cmd = sock->cmd; ++#endif + bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; + bool is_listen = sock->has_server ? sock->server : true; + bool is_telnet = sock->has_telnet ? sock->telnet : false; +@@ -1351,6 +1415,14 @@ static void qmp_chardev_open_socket(Chardev *chr, + + update_disconnected_filename(s); + ++#ifndef _WIN32 ++ if (cmd) { ++ chardev_open_socket_cmd(chr, cmd, errp); ++ ++ /* everything ready (or failed permanently) before we return */ ++ *be_opened = true; ++ } else ++#endif + if (s->is_listen) { + if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, + is_waitconnect, errp) < 0) { +@@ -1370,9 +1442,26 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + const char *host = qemu_opt_get(opts, "host"); + const char *port = qemu_opt_get(opts, "port"); + const char *fd = qemu_opt_get(opts, "fd"); ++#ifndef _WIN32 ++ const char *cmd = qemu_opt_get(opts, "cmd"); ++#endif + SocketAddressLegacy *addr; + ChardevSocket *sock; + ++#ifndef _WIN32 ++ if (cmd) { ++ /* ++ * Here we have to ensure that no options are set which are incompatible with ++ * spawning a command, otherwise unmodified code that doesn't know about ++ * command spawning (like socket_reconnect_timeout()) might get called. ++ */ ++ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { ++ error_setg(errp, "chardev: socket: cmd does not support any additional options"); ++ return; ++ } ++ } else ++#endif ++ + if ((!!path + !!fd + !!host) != 1) { + error_setg(errp, + "Exactly one of 'path', 'fd' or 'host' required"); +@@ -1415,12 +1504,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, + sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); + sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); + ++#ifndef _WIN32 ++ sock->cmd = g_strdup(cmd); ++#endif ++ + addr = g_new0(SocketAddressLegacy, 1); ++#ifndef _WIN32 ++ if (path || cmd) { ++#else + if (path) { ++#endif + UnixSocketAddress *q_unix; + addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX; + q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); ++#ifndef _WIN32 ++ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); ++#else + q_unix->path = g_strdup(path); ++#endif + } else if (host) { + addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET; + addr->u.inet.data = g_new(InetSocketAddress, 1); +diff --git a/chardev/char.c b/chardev/char.c +index 7b6b2cb1..0c2ca64b 100644 +--- a/chardev/char.c ++++ b/chardev/char.c +@@ -837,6 +837,9 @@ QemuOptsList qemu_chardev_opts = { + },{ + .name = "path", + .type = QEMU_OPT_STRING, ++ },{ ++ .name = "cmd", ++ .type = QEMU_OPT_STRING, + },{ + .name = "host", + .type = QEMU_OPT_STRING, +diff --git a/qapi/char.json b/qapi/char.json +index a6e81ac7..517962c6 100644 +--- a/qapi/char.json ++++ b/qapi/char.json +@@ -247,6 +247,10 @@ + # + # @addr: socket address to listen on (server=true) + # or connect to (server=false) ++# @cmd: command to run via "sh -c" with stdin as one end of ++# a AF_UNIX SOCK_DSTREAM socket pair. The other end ++# is used by the chardev. Either an addr or a cmd can ++# be specified, but not both. + # @tls-creds: the ID of the TLS credentials object (since 2.6) + # @tls-authz: the ID of the QAuthZ authorization object against which + # the client's x509 distinguished name will be validated. This +@@ -272,6 +276,7 @@ + ## + { 'struct': 'ChardevSocket', + 'data': { 'addr': 'SocketAddressLegacy', ++ '*cmd': 'str', + '*tls-creds': 'str', + '*tls-authz' : 'str', + '*server': 'bool', diff --git a/meta/recipes-devtools/qemu/qemu/0006-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch b/meta/recipes-devtools/qemu/qemu/0006-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch deleted file mode 100644 index b62a588c66..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0006-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 107fd860529a3c1319d54c3c225758457b0d9394 Mon Sep 17 00:00:00 2001 -From: Stephen Arnold -Date: Sun, 12 Jun 2016 18:09:56 -0700 -Subject: [PATCH] qemu-native: set ld.bfd, fix cflags, and set some environment - -Upstream-Status: Pending - ---- - configure | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/configure b/configure -index eaf9bb5e..de2933d1 100755 ---- a/configure -+++ b/configure -@@ -5928,10 +5928,6 @@ write_c_skeleton - if test "$gcov" = "yes" ; then - CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" - LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" --elif test "$fortify_source" = "yes" ; then -- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" --elif test "$debug" = "no"; then -- CFLAGS="-O2 $CFLAGS" - fi - - if test "$have_asan" = "yes"; then diff --git a/meta/recipes-devtools/qemu/qemu/0007-apic-fixup-fallthrough-to-PIC.patch b/meta/recipes-devtools/qemu/qemu/0007-apic-fixup-fallthrough-to-PIC.patch new file mode 100644 index 0000000000..b50e8c2545 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0007-apic-fixup-fallthrough-to-PIC.patch @@ -0,0 +1,44 @@ +From f51e49e7d7d87b7254242b7360f99c2df94a5a2d Mon Sep 17 00:00:00 2001 +From: Mark Asselstine +Date: Tue, 26 Feb 2013 11:43:28 -0500 +Subject: [PATCH] apic: fixup fallthrough to PIC + +Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC +interrupts through the local APIC if the local APIC config says so.] +missed a check to ensure the local APIC is enabled. Since if the local +APIC is disabled it doesn't matter what the local APIC config says. + +If this check isn't done and the guest has disabled the local APIC the +guest will receive a general protection fault, similar to what is seen +here: + +https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html + +The GPF is caused by an attempt to service interrupt 0xffffffff. This +comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() +(with the local APIC disabled apic_get_interrupt() returns -1). +apic_accept_pic_intr() returns 0 and thus the interrupt number which +is returned from cpu_get_pic_interrupt(), and which is attempted to be +serviced, is -1. + +Signed-off-by: Mark Asselstine +Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] +Signed-off-by: He Zhe + +--- + hw/intc/apic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/intc/apic.c b/hw/intc/apic.c +index bce89911..df4b582e 100644 +--- a/hw/intc/apic.c ++++ b/hw/intc/apic.c +@@ -603,7 +603,7 @@ int apic_accept_pic_intr(DeviceState *dev) + APICCommonState *s = APIC(dev); + uint32_t lvt0; + +- if (!s) ++ if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) + return -1; + + lvt0 = s->lvt[APIC_LVT_LINT0]; diff --git a/meta/recipes-devtools/qemu/qemu/0007-chardev-connect-socket-to-a-spawned-command.patch b/meta/recipes-devtools/qemu/qemu/0007-chardev-connect-socket-to-a-spawned-command.patch deleted file mode 100644 index f3f3dc3f5e..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0007-chardev-connect-socket-to-a-spawned-command.patch +++ /dev/null @@ -1,239 +0,0 @@ -From 136e159482a1bc8676cbe6e767055d0c3fb20065 Mon Sep 17 00:00:00 2001 -From: Alistair Francis -Date: Thu, 21 Dec 2017 11:35:16 -0800 -Subject: [PATCH] chardev: connect socket to a spawned command - -The command is started in a shell (sh -c) with stdin connect to QEMU -via a Unix domain stream socket. QEMU then exchanges data via its own -end of the socket, just like it normally does. - -"-chardev socket" supports some ways of connecting via protocols like -telnet, but that is only a subset of the functionality supported by -tools socat. To use socat instead, for example to connect via a socks -proxy, use: - - -chardev 'socket,id=socat,cmd=exec socat FD:0 SOCKS4A:socks-proxy.localdomain:example.com:9999,,socksuser=nobody' \ - -device usb-serial,chardev=socat - -Beware that commas in the command must be escaped as double commas. - -Or interactively in the console: - (qemu) chardev-add socket,id=cat,cmd=cat - (qemu) device_add usb-serial,chardev=cat - ^ac - # cat >/dev/ttyUSB0 - hello - hello - -Another usage is starting swtpm from inside QEMU. swtpm will -automatically shut down once it looses the connection to the parent -QEMU, so there is no risk of lingering processes: - - -chardev 'socket,id=chrtpm0,cmd=exec swtpm socket --terminate --ctrl type=unixio,,clientfd=0 --tpmstate dir=... --log file=swtpm.log' \ - -tpmdev emulator,id=tpm0,chardev=chrtpm0 \ - -device tpm-tis,tpmdev=tpm0 - -The patch was discussed upstream, but QEMU developers believe that the -code calling QEMU should be responsible for managing additional -processes. In OE-core, that would imply enhancing runqemu and -oeqa. This patch is a simpler solution. - -Because it is not going upstream, the patch was written so that it is -as simple as possible. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Patrick Ohly - ---- - chardev/char-socket.c | 101 ++++++++++++++++++++++++++++++++++++++++++ - chardev/char.c | 3 ++ - qapi/char.json | 5 +++ - 3 files changed, 109 insertions(+) - -diff --git a/chardev/char-socket.c b/chardev/char-socket.c -index 3916505d..a8e9dce8 100644 ---- a/chardev/char-socket.c -+++ b/chardev/char-socket.c -@@ -1273,6 +1273,67 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, - return true; - } - -+#ifndef _WIN32 -+static void chardev_open_socket_cmd(Chardev *chr, -+ const char *cmd, -+ Error **errp) -+{ -+ int fds[2] = { -1, -1 }; -+ QIOChannelSocket *sioc = NULL; -+ pid_t pid = -1; -+ const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; -+ -+ /* -+ * We need a Unix domain socket for commands like swtpm and a single -+ * connection, therefore we cannot use qio_channel_command_new_spawn() -+ * without patching it first. Duplicating the functionality is easier. -+ */ -+ if (socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds)) { -+ error_setg_errno(errp, errno, "Error creating socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC)"); -+ goto error; -+ } -+ -+ pid = qemu_fork(errp); -+ if (pid < 0) { -+ goto error; -+ } -+ -+ if (!pid) { -+ /* child */ -+ dup2(fds[1], STDIN_FILENO); -+ execv(argv[0], (char * const *)argv); -+ _exit(1); -+ } -+ -+ /* -+ * Hand over our end of the socket pair to the qio channel. -+ * -+ * We don't reap the child because it is expected to keep -+ * running. We also don't support the "reconnect" option for the -+ * same reason. -+ */ -+ sioc = qio_channel_socket_new_fd(fds[0], errp); -+ if (!sioc) { -+ goto error; -+ } -+ fds[0] = -1; -+ -+ g_free(chr->filename); -+ chr->filename = g_strdup_printf("cmd:%s", cmd); -+ tcp_chr_new_client(chr, sioc); -+ -+ error: -+ if (fds[0] >= 0) { -+ close(fds[0]); -+ } -+ if (fds[1] >= 0) { -+ close(fds[1]); -+ } -+ if (sioc) { -+ object_unref(OBJECT(sioc)); -+ } -+} -+#endif - - static void qmp_chardev_open_socket(Chardev *chr, - ChardevBackend *backend, -@@ -1281,6 +1342,9 @@ static void qmp_chardev_open_socket(Chardev *chr, - { - SocketChardev *s = SOCKET_CHARDEV(chr); - ChardevSocket *sock = backend->u.socket.data; -+#ifndef _WIN32 -+ const char *cmd = sock->cmd; -+#endif - bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; - bool is_listen = sock->has_server ? sock->server : true; - bool is_telnet = sock->has_telnet ? sock->telnet : false; -@@ -1346,6 +1410,14 @@ static void qmp_chardev_open_socket(Chardev *chr, - - update_disconnected_filename(s); - -+#ifndef _WIN32 -+ if (cmd) { -+ chardev_open_socket_cmd(chr, cmd, errp); -+ -+ /* everything ready (or failed permanently) before we return */ -+ *be_opened = true; -+ } else -+#endif - if (s->is_listen) { - if (qmp_chardev_open_socket_server(chr, is_telnet || is_tn3270, - is_waitconnect, errp) < 0) { -@@ -1365,9 +1437,26 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - const char *host = qemu_opt_get(opts, "host"); - const char *port = qemu_opt_get(opts, "port"); - const char *fd = qemu_opt_get(opts, "fd"); -+#ifndef _WIN32 -+ const char *cmd = qemu_opt_get(opts, "cmd"); -+#endif - SocketAddressLegacy *addr; - ChardevSocket *sock; - -+#ifndef _WIN32 -+ if (cmd) { -+ /* -+ * Here we have to ensure that no options are set which are incompatible with -+ * spawning a command, otherwise unmodified code that doesn't know about -+ * command spawning (like socket_reconnect_timeout()) might get called. -+ */ -+ if (path || sock->server || sock->has_telnet || sock->has_tn3270 || sock->reconnect || host || port || sock->tls_creds) { -+ error_setg(errp, "chardev: socket: cmd does not support any additional options"); -+ return; -+ } -+ } else -+#endif -+ - if ((!!path + !!fd + !!host) != 1) { - error_setg(errp, - "Exactly one of 'path', 'fd' or 'host' required"); -@@ -1410,12 +1499,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, - sock->has_tls_authz = qemu_opt_get(opts, "tls-authz"); - sock->tls_authz = g_strdup(qemu_opt_get(opts, "tls-authz")); - -+#ifndef _WIN32 -+ sock->cmd = g_strdup(cmd); -+#endif -+ - addr = g_new0(SocketAddressLegacy, 1); -+#ifndef _WIN32 -+ if (path || cmd) { -+#else - if (path) { -+#endif - UnixSocketAddress *q_unix; - addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX; - q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); -+#ifndef _WIN32 -+ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); -+#else - q_unix->path = g_strdup(path); -+#endif - } else if (host) { - addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET; - addr->u.inet.data = g_new(InetSocketAddress, 1); -diff --git a/chardev/char.c b/chardev/char.c -index 514cd6b0..36a40d67 100644 ---- a/chardev/char.c -+++ b/chardev/char.c -@@ -835,6 +835,9 @@ QemuOptsList qemu_chardev_opts = { - },{ - .name = "path", - .type = QEMU_OPT_STRING, -+ },{ -+ .name = "cmd", -+ .type = QEMU_OPT_STRING, - },{ - .name = "host", - .type = QEMU_OPT_STRING, -diff --git a/qapi/char.json b/qapi/char.json -index a6e81ac7..517962c6 100644 ---- a/qapi/char.json -+++ b/qapi/char.json -@@ -247,6 +247,10 @@ - # - # @addr: socket address to listen on (server=true) - # or connect to (server=false) -+# @cmd: command to run via "sh -c" with stdin as one end of -+# a AF_UNIX SOCK_DSTREAM socket pair. The other end -+# is used by the chardev. Either an addr or a cmd can -+# be specified, but not both. - # @tls-creds: the ID of the TLS credentials object (since 2.6) - # @tls-authz: the ID of the QAuthZ authorization object against which - # the client's x509 distinguished name will be validated. This -@@ -272,6 +276,7 @@ - ## - { 'struct': 'ChardevSocket', - 'data': { 'addr': 'SocketAddressLegacy', -+ '*cmd': 'str', - '*tls-creds': 'str', - '*tls-authz' : 'str', - '*server': 'bool', diff --git a/meta/recipes-devtools/qemu/qemu/0008-apic-fixup-fallthrough-to-PIC.patch b/meta/recipes-devtools/qemu/qemu/0008-apic-fixup-fallthrough-to-PIC.patch deleted file mode 100644 index 13037f33f3..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0008-apic-fixup-fallthrough-to-PIC.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 1b3f264e2ba18caf658fae27293c426c8366c6a3 Mon Sep 17 00:00:00 2001 -From: Mark Asselstine -Date: Tue, 26 Feb 2013 11:43:28 -0500 -Subject: [PATCH] apic: fixup fallthrough to PIC - -Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC -interrupts through the local APIC if the local APIC config says so.] -missed a check to ensure the local APIC is enabled. Since if the local -APIC is disabled it doesn't matter what the local APIC config says. - -If this check isn't done and the guest has disabled the local APIC the -guest will receive a general protection fault, similar to what is seen -here: - -https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html - -The GPF is caused by an attempt to service interrupt 0xffffffff. This -comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr() -(with the local APIC disabled apic_get_interrupt() returns -1). -apic_accept_pic_intr() returns 0 and thus the interrupt number which -is returned from cpu_get_pic_interrupt(), and which is attempted to be -serviced, is -1. - -Signed-off-by: Mark Asselstine -Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html] -Signed-off-by: He Zhe - ---- - hw/intc/apic.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/hw/intc/apic.c b/hw/intc/apic.c -index 6ea619c3..f892811e 100644 ---- a/hw/intc/apic.c -+++ b/hw/intc/apic.c -@@ -604,7 +604,7 @@ int apic_accept_pic_intr(DeviceState *dev) - APICCommonState *s = APIC(dev); - uint32_t lvt0; - -- if (!s) -+ if (!s || !(s->spurious_vec & APIC_SV_ENABLE)) - return -1; - - lvt0 = s->lvt[APIC_LVT_LINT0]; diff --git a/meta/recipes-devtools/qemu/qemu/0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch b/meta/recipes-devtools/qemu/qemu/0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch new file mode 100644 index 0000000000..e562f25bec --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch @@ -0,0 +1,33 @@ +From 25a064f91f73630e5dff2a6aeb23d953c469cea6 Mon Sep 17 00:00:00 2001 +From: Alistair Francis +Date: Wed, 17 Jan 2018 10:51:49 -0800 +Subject: [PATCH] linux-user: Fix webkitgtk hangs on 32-bit x86 target + +Since commit "linux-user: Tidy and enforce reserved_va initialization" +(18e80c55bb6ec17c05ec0ba717ec83933c2bfc07) the Yocto webkitgtk build +hangs when cross compiling for 32-bit x86 on a 64-bit x86 machine using +musl. + +To fix the issue reduce the MAX_RESERVED_VA macro to be a closer match +to what it was before the problematic commit. + +Upstream-Status: Submitted http://lists.gnu.org/archive/html/qemu-devel/2018-01/msg04185.html +Signed-off-by: Alistair Francis + +--- + linux-user/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux-user/main.c b/linux-user/main.c +index 8ffc5251..4067e739 100644 +--- a/linux-user/main.c ++++ b/linux-user/main.c +@@ -77,7 +77,7 @@ int have_guest_base; + (TARGET_LONG_BITS == 32 || defined(TARGET_ABI32)) + /* There are a number of places where we assign reserved_va to a variable + of type abi_ulong and expect it to fit. Avoid the last page. */ +-# define MAX_RESERVED_VA (0xfffffffful & TARGET_PAGE_MASK) ++# define MAX_RESERVED_VA (0x7ffffffful & TARGET_PAGE_MASK) + # else + # define MAX_RESERVED_VA (1ul << TARGET_VIRT_ADDR_SPACE_BITS) + # endif diff --git a/meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch b/meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch new file mode 100644 index 0000000000..4072d9455f --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0009-Fix-webkitgtk-builds.patch @@ -0,0 +1,137 @@ +From b633b9a1813fcd715dce44659a89293f1c64ae8c Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Fri, 1 Jun 2018 08:41:07 +0000 +Subject: [PATCH] Fix webkitgtk builds + +This is a partial revert of "linux-user: fix mmap/munmap/mprotect/mremap/shmat". + +This patch fixes qemu-i386 hangs during gobject-introspection in webkitgtk build +when musl is used on qemux86. This is the same issue that +0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch was +fixing in the 2.11 release. + +This patch also fixes a build failure when building webkitgtk for +qemumips. A QEMU assert is seen while building webkitgtk: +page_check_range: Assertion `start < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)' failed. + +This reverts commit ebf9a3630c911d0cfc9c20f7cafe9ba4f88cf583. + +Upstream-Status: Pending +Signed-off-by: Alistair Francis +--- + include/exec/cpu-all.h | 6 +----- + include/exec/cpu_ldst.h | 5 ++++- + linux-user/mmap.c | 17 ++++------------- + linux-user/syscall.c | 5 +---- + 4 files changed, 10 insertions(+), 23 deletions(-) + +diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h +index 536ea58f81..4c63a6a2e4 100644 +--- a/include/exec/cpu-all.h ++++ b/include/exec/cpu-all.h +@@ -162,12 +162,8 @@ extern unsigned long guest_base; + extern int have_guest_base; + extern unsigned long reserved_va; + +-#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS +-#define GUEST_ADDR_MAX (~0ul) +-#else +-#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : \ ++#define GUEST_ADDR_MAX (reserved_va ? reserved_va : \ + (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1) +-#endif + #else + + #include "exec/hwaddr.h" +diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h +index 9151fdb042..cb2b8f329f 100644 +--- a/include/exec/cpu_ldst.h ++++ b/include/exec/cpu_ldst.h +@@ -65,7 +65,10 @@ typedef uint64_t abi_ptr; + #if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS + #define guest_addr_valid(x) (1) + #else +-#define guest_addr_valid(x) ((x) <= GUEST_ADDR_MAX) ++#define guest_addr_valid(x) ({ \ ++ ((x) < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \ ++ (!reserved_va || ((x) < reserved_va)); \ ++}) + #endif + #define h2g_valid(x) guest_addr_valid((unsigned long)(x) - guest_base) + +diff --git a/linux-user/mmap.c b/linux-user/mmap.c +index 46a6e3a761..7735465462 100644 +--- a/linux-user/mmap.c ++++ b/linux-user/mmap.c +@@ -78,7 +78,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) + return -TARGET_EINVAL; + len = TARGET_PAGE_ALIGN(len); + end = start + len; +- if (!guest_range_valid(start, len)) { ++ if (end < start) { + return -TARGET_ENOMEM; + } + prot &= PROT_READ | PROT_WRITE | PROT_EXEC; +@@ -495,8 +495,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, + * It can fail only on 64-bit host with 32-bit target. + * On any other target/host host mmap() handles this error correctly. + */ +- if (!guest_range_valid(start, len)) { +- errno = ENOMEM; ++ if ((unsigned long)start + len - 1 > (abi_ulong) -1) { ++ errno = EINVAL; + goto fail; + } + +@@ -636,10 +636,8 @@ int target_munmap(abi_ulong start, abi_ulong len) + if (start & ~TARGET_PAGE_MASK) + return -TARGET_EINVAL; + len = TARGET_PAGE_ALIGN(len); +- if (len == 0 || !guest_range_valid(start, len)) { ++ if (len == 0) + return -TARGET_EINVAL; +- } +- + mmap_lock(); + end = start + len; + real_start = start & qemu_host_page_mask; +@@ -694,13 +692,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + int prot; + void *host_addr; + +- if (!guest_range_valid(old_addr, old_size) || +- ((flags & MREMAP_FIXED) && +- !guest_range_valid(new_addr, new_size))) { +- errno = ENOMEM; +- return -1; +- } +- + mmap_lock(); + + if (flags & MREMAP_FIXED) { +diff --git a/linux-user/syscall.c b/linux-user/syscall.c +index 8b41a03901..bc5d85de02 100644 +--- a/linux-user/syscall.c ++++ b/linux-user/syscall.c +@@ -4031,9 +4031,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, + return -TARGET_EINVAL; + } + } +- if (!guest_range_valid(shmaddr, shm_info.shm_segsz)) { +- return -TARGET_EINVAL; +- } + + mmap_lock(); + +@@ -6881,7 +6878,7 @@ static int open_self_maps(void *cpu_env, int fd) + } + if (h2g_valid(min)) { + int flags = page_get_flags(h2g(min)); +- max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX) + 1; ++ max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX); + if (page_check_range(h2g(min), max - min, flags) == -1) { + continue; + } +-- +2.22.0 + diff --git a/meta/recipes-devtools/qemu/qemu/0009-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch b/meta/recipes-devtools/qemu/qemu/0009-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch deleted file mode 100644 index c572ff94d0..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0009-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a33ae91504ea4d254b5ace64a84791d3c96c9773 Mon Sep 17 00:00:00 2001 -From: Alistair Francis -Date: Wed, 17 Jan 2018 10:51:49 -0800 -Subject: [PATCH] linux-user: Fix webkitgtk hangs on 32-bit x86 target - -Since commit "linux-user: Tidy and enforce reserved_va initialization" -(18e80c55bb6ec17c05ec0ba717ec83933c2bfc07) the Yocto webkitgtk build -hangs when cross compiling for 32-bit x86 on a 64-bit x86 machine using -musl. - -To fix the issue reduce the MAX_RESERVED_VA macro to be a closer match -to what it was before the problematic commit. - -Upstream-Status: Submitted http://lists.gnu.org/archive/html/qemu-devel/2018-01/msg04185.html -Signed-off-by: Alistair Francis - ---- - linux-user/main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/linux-user/main.c b/linux-user/main.c -index a0aba9cb..34c54924 100644 ---- a/linux-user/main.c -+++ b/linux-user/main.c -@@ -69,7 +69,7 @@ int have_guest_base; - (TARGET_LONG_BITS == 32 || defined(TARGET_ABI32)) - /* There are a number of places where we assign reserved_va to a variable - of type abi_ulong and expect it to fit. Avoid the last page. */ --# define MAX_RESERVED_VA (0xfffffffful & TARGET_PAGE_MASK) -+# define MAX_RESERVED_VA (0x7ffffffful & TARGET_PAGE_MASK) - # else - # define MAX_RESERVED_VA (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - # endif diff --git a/meta/recipes-devtools/qemu/qemu/0010-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch b/meta/recipes-devtools/qemu/qemu/0010-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch deleted file mode 100644 index 3418eb7c65..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0010-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 2a66bd95c856de6950fbd802c5b99075207c1d76 Mon Sep 17 00:00:00 2001 -From: Martin Jansa -Date: Fri, 1 Jun 2018 08:41:07 +0000 -Subject: [PATCH] Revert "linux-user: fix mmap/munmap/mprotect/mremap/shmat" - -Causes qemu-i386 to hang during gobject-introspection in webkitgtk build -when musl is used on qemux86 - the same issue as -0010-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch -was fixing in 2.11.0 release, but with this patch the fix no longer worked -as discussed here: -http://lists.openembedded.org/pipermail/openembedded-core/2018-May/150302.html -http://lists.openembedded.org/pipermail/openembedded-core/2018-June/151382.html - -This reverts commit ebf9a3630c911d0cfc9c20f7cafe9ba4f88cf583. - -Upstream-Status: Pending - ---- - include/exec/cpu-all.h | 6 +----- - include/exec/cpu_ldst.h | 16 +++++++++------- - linux-user/mmap.c | 17 ++++------------- - linux-user/syscall.c | 5 +---- - 4 files changed, 15 insertions(+), 29 deletions(-) - -diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h -index b16c9ec5..612db6a0 100644 ---- a/include/exec/cpu-all.h -+++ b/include/exec/cpu-all.h -@@ -163,12 +163,8 @@ extern unsigned long guest_base; - extern int have_guest_base; - extern unsigned long reserved_va; - --#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS --#define GUEST_ADDR_MAX (~0ul) --#else --#define GUEST_ADDR_MAX (reserved_va ? reserved_va - 1 : \ -+#define GUEST_ADDR_MAX (reserved_va ? reserved_va : \ - (1ul << TARGET_VIRT_ADDR_SPACE_BITS) - 1) --#endif - #else - - #include "exec/hwaddr.h" -diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h -index d78041d7..845639f7 100644 ---- a/include/exec/cpu_ldst.h -+++ b/include/exec/cpu_ldst.h -@@ -62,13 +62,15 @@ typedef uint64_t abi_ptr; - /* All direct uses of g2h and h2g need to go away for usermode softmmu. */ - #define g2h(x) ((void *)((unsigned long)(abi_ptr)(x) + guest_base)) - --#define guest_addr_valid(x) ((x) <= GUEST_ADDR_MAX) --#define h2g_valid(x) guest_addr_valid((unsigned long)(x) - guest_base) -- --static inline int guest_range_valid(unsigned long start, unsigned long len) --{ -- return len - 1 <= GUEST_ADDR_MAX && start <= GUEST_ADDR_MAX - len + 1; --} -+#if HOST_LONG_BITS <= TARGET_VIRT_ADDR_SPACE_BITS -+#define h2g_valid(x) 1 -+#else -+#define h2g_valid(x) ({ \ -+ unsigned long __guest = (unsigned long)(x) - guest_base; \ -+ (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \ -+ (!reserved_va || (__guest < reserved_va)); \ -+}) -+#endif - - #define h2g_nocheck(x) ({ \ - unsigned long __ret = (unsigned long)(x) - guest_base; \ -diff --git a/linux-user/mmap.c b/linux-user/mmap.c -index e0249efe..cfe34b35 100644 ---- a/linux-user/mmap.c -+++ b/linux-user/mmap.c -@@ -79,7 +79,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) - return -TARGET_EINVAL; - len = TARGET_PAGE_ALIGN(len); - end = start + len; -- if (!guest_range_valid(start, len)) { -+ if (end < start) { - return -TARGET_ENOMEM; - } - prot &= PROT_READ | PROT_WRITE | PROT_EXEC; -@@ -490,8 +490,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - * It can fail only on 64-bit host with 32-bit target. - * On any other target/host host mmap() handles this error correctly. - */ -- if (!guest_range_valid(start, len)) { -- errno = ENOMEM; -+ if ((unsigned long)start + len - 1 > (abi_ulong) -1) { -+ errno = EINVAL; - goto fail; - } - -@@ -631,10 +631,8 @@ int target_munmap(abi_ulong start, abi_ulong len) - if (start & ~TARGET_PAGE_MASK) - return -TARGET_EINVAL; - len = TARGET_PAGE_ALIGN(len); -- if (len == 0 || !guest_range_valid(start, len)) { -+ if (len == 0) - return -TARGET_EINVAL; -- } -- - mmap_lock(); - end = start + len; - real_start = start & qemu_host_page_mask; -@@ -689,13 +687,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - int prot; - void *host_addr; - -- if (!guest_range_valid(old_addr, old_size) || -- ((flags & MREMAP_FIXED) && -- !guest_range_valid(new_addr, new_size))) { -- errno = ENOMEM; -- return -1; -- } -- - mmap_lock(); - - if (flags & MREMAP_FIXED) { -diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 96cd4bf8..e6754772 100644 ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -3860,9 +3860,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env, - return -TARGET_EINVAL; - } - } -- if (!guest_range_valid(shmaddr, shm_info.shm_segsz)) { -- return -TARGET_EINVAL; -- } - - mmap_lock(); - -@@ -6633,7 +6630,7 @@ static int open_self_maps(void *cpu_env, int fd) - } - if (h2g_valid(min)) { - int flags = page_get_flags(h2g(min)); -- max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX) + 1; -+ max = h2g_valid(max - 1) ? max : (uintptr_t)g2h(GUEST_ADDR_MAX); - if (page_check_range(h2g(min), max - min, flags) == -1) { - continue; - } diff --git a/meta/recipes-devtools/qemu/qemu/0010-fix-libcap-header-issue-on-some-distro.patch b/meta/recipes-devtools/qemu/qemu/0010-fix-libcap-header-issue-on-some-distro.patch new file mode 100644 index 0000000000..3a7d7bbd33 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0010-fix-libcap-header-issue-on-some-distro.patch @@ -0,0 +1,86 @@ +From 9125afb733d8c96416bb83c5adad39bb8d0803a1 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Tue, 12 Mar 2013 09:54:06 +0800 +Subject: [PATCH] fix libcap header issue on some distro + +1, When build qemu-native on SLED 11.2, there is an error: +... +| In file included from /usr/include/bits/sigcontext.h:28, +| from /usr/include/signal.h:339, +| from /buildarea2/tmp/work/i686-linux/qemu-native/1.4.0-r0/ +qemu-1.4.0/include/qemu-common.h:42, +| from fsdev/virtfs-proxy-helper.c:23: +| /usr/include/asm/sigcontext.h:28: error: expected specifier- +qualifier-list before '__u64' +| /usr/include/asm/sigcontext.h:191: error: expected specifier- +qualifier-list before '__u64' +... + +2, The virtfs-proxy-helper.c includes and +qemu-common.h in sequence. The header include map is: +(`-->' presents `include') +... +"virtfs-proxy-helper.c" --> +... +"virtfs-proxy-helper.c" --> "qemu-common.h" --> --> + --> --> --> + --> --> +... + +3, The bug is found on SLED 11.2 x86. In libcap header file +/usr/include/sys/capability.h, it does evil stuff like this: +... + 25 /* + 26 * Make sure we can be included from userland by preventing + 27 * capability.h from including other kernel headers + 28 */ + 29 #define _LINUX_TYPES_H + 30 #define _LINUX_FS_H + 31 #define __LINUX_COMPILER_H + 32 #define __user + 33 + 34 typedef unsigned int __u32; + 35 typedef __u32 __le32; +... +This completely prevents including /usr/include/linux/types.h. +The above ` --> ' is prevented, +and '__u64' is defined in . + +4, Modify virtfs-proxy-helper.c to include +last to workaround the issue. + +http://www.linuxtv.org/pipermail/vdr/2009-August/021194.html +http://patchwork.linuxtv.org/patch/12748/ + +Upstream-Status: Pending +Signed-off-by: Hongxu Jia + +--- + fsdev/virtfs-proxy-helper.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c +index 6f132c5f..8329950c 100644 +--- a/fsdev/virtfs-proxy-helper.c ++++ b/fsdev/virtfs-proxy-helper.c +@@ -13,7 +13,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -27,7 +26,11 @@ + #include "9p-iov-marshal.h" + #include "hw/9pfs/9p-proxy.h" + #include "fsdev/9p-iov-marshal.h" +- ++/* ++ * Include this one last due to some versions of it being buggy: ++ * http://www.linuxtv.org/pipermail/vdr/2009-August/021194.html ++ */ ++#include + #define PROGNAME "virtfs-proxy-helper" + + #ifndef XFS_SUPER_MAGIC diff --git a/meta/recipes-devtools/qemu/qemu/0011-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch b/meta/recipes-devtools/qemu/qemu/0011-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch new file mode 100644 index 0000000000..e5ebfc1267 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/0011-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch @@ -0,0 +1,74 @@ +From 0a53e906510cce1f32bc04a11e81ea40f834dac4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= +Date: Wed, 12 Aug 2015 15:11:30 -0500 +Subject: [PATCH] cpus.c: Add error messages when qemi_cpu_kick_thread fails. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add custom_debug.h with function for print backtrace information. +When pthread_kill fails in qemu_cpu_kick_thread display backtrace and +current cpu information. + +Upstream-Status: Inappropriate +Signed-off-by: Aníbal Limón + +--- + cpus.c | 5 +++++ + custom_debug.h | 24 ++++++++++++++++++++++++ + 2 files changed, 29 insertions(+) + create mode 100644 custom_debug.h + +diff --git a/cpus.c b/cpus.c +index e83f72b4..e6e2576e 100644 +--- a/cpus.c ++++ b/cpus.c +@@ -1769,6 +1769,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) + return NULL; + } + ++#include "custom_debug.h" ++ + static void qemu_cpu_kick_thread(CPUState *cpu) + { + #ifndef _WIN32 +@@ -1781,6 +1783,9 @@ static void qemu_cpu_kick_thread(CPUState *cpu) + err = pthread_kill(cpu->thread->thread, SIG_IPI); + if (err && err != ESRCH) { + fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); ++ fprintf(stderr, "CPU #%d:\n", cpu->cpu_index); ++ cpu_dump_state(cpu, stderr, 0); ++ backtrace_print(); + exit(1); + } + #else /* _WIN32 */ +diff --git a/custom_debug.h b/custom_debug.h +new file mode 100644 +index 00000000..f029e455 +--- /dev/null ++++ b/custom_debug.h +@@ -0,0 +1,24 @@ ++#include ++#include ++#define BACKTRACE_MAX 128 ++static void backtrace_print(void) ++{ ++ int nfuncs = 0; ++ void *buf[BACKTRACE_MAX]; ++ char **symbols; ++ int i; ++ ++ nfuncs = backtrace(buf, BACKTRACE_MAX); ++ ++ symbols = backtrace_symbols(buf, nfuncs); ++ if (symbols == NULL) { ++ fprintf(stderr, "backtrace_print failed to get symbols"); ++ return; ++ } ++ ++ fprintf(stderr, "Backtrace ...\n"); ++ for (i = 0; i < nfuncs; i++) ++ fprintf(stderr, "%s\n", symbols[i]); ++ ++ free(symbols); ++} diff --git a/meta/recipes-devtools/qemu/qemu/0011-fix-libcap-header-issue-on-some-distro.patch b/meta/recipes-devtools/qemu/qemu/0011-fix-libcap-header-issue-on-some-distro.patch deleted file mode 100644 index 3a7d7bbd33..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0011-fix-libcap-header-issue-on-some-distro.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 9125afb733d8c96416bb83c5adad39bb8d0803a1 Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Tue, 12 Mar 2013 09:54:06 +0800 -Subject: [PATCH] fix libcap header issue on some distro - -1, When build qemu-native on SLED 11.2, there is an error: -... -| In file included from /usr/include/bits/sigcontext.h:28, -| from /usr/include/signal.h:339, -| from /buildarea2/tmp/work/i686-linux/qemu-native/1.4.0-r0/ -qemu-1.4.0/include/qemu-common.h:42, -| from fsdev/virtfs-proxy-helper.c:23: -| /usr/include/asm/sigcontext.h:28: error: expected specifier- -qualifier-list before '__u64' -| /usr/include/asm/sigcontext.h:191: error: expected specifier- -qualifier-list before '__u64' -... - -2, The virtfs-proxy-helper.c includes and -qemu-common.h in sequence. The header include map is: -(`-->' presents `include') -... -"virtfs-proxy-helper.c" --> -... -"virtfs-proxy-helper.c" --> "qemu-common.h" --> --> - --> --> --> - --> --> -... - -3, The bug is found on SLED 11.2 x86. In libcap header file -/usr/include/sys/capability.h, it does evil stuff like this: -... - 25 /* - 26 * Make sure we can be included from userland by preventing - 27 * capability.h from including other kernel headers - 28 */ - 29 #define _LINUX_TYPES_H - 30 #define _LINUX_FS_H - 31 #define __LINUX_COMPILER_H - 32 #define __user - 33 - 34 typedef unsigned int __u32; - 35 typedef __u32 __le32; -... -This completely prevents including /usr/include/linux/types.h. -The above ` --> ' is prevented, -and '__u64' is defined in . - -4, Modify virtfs-proxy-helper.c to include -last to workaround the issue. - -http://www.linuxtv.org/pipermail/vdr/2009-August/021194.html -http://patchwork.linuxtv.org/patch/12748/ - -Upstream-Status: Pending -Signed-off-by: Hongxu Jia - ---- - fsdev/virtfs-proxy-helper.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c -index 6f132c5f..8329950c 100644 ---- a/fsdev/virtfs-proxy-helper.c -+++ b/fsdev/virtfs-proxy-helper.c -@@ -13,7 +13,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -27,7 +26,11 @@ - #include "9p-iov-marshal.h" - #include "hw/9pfs/9p-proxy.h" - #include "fsdev/9p-iov-marshal.h" -- -+/* -+ * Include this one last due to some versions of it being buggy: -+ * http://www.linuxtv.org/pipermail/vdr/2009-August/021194.html -+ */ -+#include - #define PROGNAME "virtfs-proxy-helper" - - #ifndef XFS_SUPER_MAGIC diff --git a/meta/recipes-devtools/qemu/qemu/0012-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch b/meta/recipes-devtools/qemu/qemu/0012-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch deleted file mode 100644 index 04664195d1..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0012-cpus.c-Add-error-messages-when-qemi_cpu_kick_thread-.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0a53e906510cce1f32bc04a11e81ea40f834dac4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= -Date: Wed, 12 Aug 2015 15:11:30 -0500 -Subject: [PATCH] cpus.c: Add error messages when qemi_cpu_kick_thread fails. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add custom_debug.h with function for print backtrace information. -When pthread_kill fails in qemu_cpu_kick_thread display backtrace and -current cpu information. - -Upstream-Status: Inappropriate -Signed-off-by: Aníbal Limón - ---- - cpus.c | 5 +++++ - custom_debug.h | 24 ++++++++++++++++++++++++ - 2 files changed, 29 insertions(+) - create mode 100644 custom_debug.h - -diff --git a/cpus.c b/cpus.c -index e83f72b4..e6e2576e 100644 ---- a/cpus.c -+++ b/cpus.c -@@ -1769,6 +1769,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) - return NULL; - } - -+#include "custom_debug.h" -+ - static void qemu_cpu_kick_thread(CPUState *cpu) - { - #ifndef _WIN32 -@@ -1781,6 +1783,9 @@ static void qemu_cpu_kick_thread(CPUState *cpu) - err = pthread_kill(cpu->thread->thread, SIG_IPI); - if (err && err != ESRCH) { - fprintf(stderr, "qemu:%s: %s", __func__, strerror(err)); -+ fprintf(stderr, "CPU #%d:\n", cpu->cpu_index); -+ cpu_dump_state(cpu, stderr, fprintf, 0); -+ backtrace_print(); - exit(1); - } - #else /* _WIN32 */ -diff --git a/custom_debug.h b/custom_debug.h -new file mode 100644 -index 00000000..f029e455 ---- /dev/null -+++ b/custom_debug.h -@@ -0,0 +1,24 @@ -+#include -+#include -+#define BACKTRACE_MAX 128 -+static void backtrace_print(void) -+{ -+ int nfuncs = 0; -+ void *buf[BACKTRACE_MAX]; -+ char **symbols; -+ int i; -+ -+ nfuncs = backtrace(buf, BACKTRACE_MAX); -+ -+ symbols = backtrace_symbols(buf, nfuncs); -+ if (symbols == NULL) { -+ fprintf(stderr, "backtrace_print failed to get symbols"); -+ return; -+ } -+ -+ fprintf(stderr, "Backtrace ...\n"); -+ for (i = 0; i < nfuncs; i++) -+ fprintf(stderr, "%s\n", symbols[i]); -+ -+ free(symbols); -+} diff --git a/meta/recipes-devtools/qemu/qemu/0013-target-arm-Fix-vector-operation-segfault.patch b/meta/recipes-devtools/qemu/qemu/0013-target-arm-Fix-vector-operation-segfault.patch deleted file mode 100644 index c1dd957dc9..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0013-target-arm-Fix-vector-operation-segfault.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 2f143d3ad1c05e91cf2cdf5de06d59a80a95e6c8 Mon Sep 17 00:00:00 2001 -From: Alistair Francis -Date: Thu, 23 May 2019 14:47:43 +0100 -Subject: [PATCH] target/arm: Fix vector operation segfault -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Commit 89e68b575 "target/arm: Use vector operations for saturation" -causes this abort() when booting QEMU ARM with a Cortex-A15: - -0 0x00007ffff4c2382f in raise () at /usr/lib/libc.so.6 -1 0x00007ffff4c0e672 in abort () at /usr/lib/libc.so.6 -2 0x00005555559c1839 in disas_neon_data_insn (insn=, s=) at ./target/arm/translate.c:6673 -3 0x00005555559c1839 in disas_neon_data_insn (s=, insn=) at ./target/arm/translate.c:6386 -4 0x00005555559cd8a4 in disas_arm_insn (insn=4081107068, s=0x7fffe59a9510) at ./target/arm/translate.c:9289 -5 0x00005555559cd8a4 in arm_tr_translate_insn (dcbase=0x7fffe59a9510, cpu=) at ./target/arm/translate.c:13612 -6 0x00005555558d1d39 in translator_loop (ops=0x5555561cc580 , db=0x7fffe59a9510, cpu=0x55555686a2f0, tb=, max_insns=) at ./accel/tcg/translator.c:96 -7 0x00005555559d10d4 in gen_intermediate_code (cpu=cpu@entry=0x55555686a2f0, tb=tb@entry=0x7fffd7840080 , max_insns=max_insns@entry=512) at ./target/arm/translate.c:13901 -8 0x00005555558d06b9 in tb_gen_code (cpu=cpu@entry=0x55555686a2f0, pc=3067096216, cs_base=0, flags=192, cflags=-16252928, cflags@entry=524288) at ./accel/tcg/translate-all.c:1736 -9 0x00005555558ce467 in tb_find (cf_mask=524288, tb_exit=1, last_tb=0x7fffd783e640 , cpu=0x1) at ./accel/tcg/cpu-exec.c:407 -10 0x00005555558ce467 in cpu_exec (cpu=cpu@entry=0x55555686a2f0) at ./accel/tcg/cpu-exec.c:728 -11 0x000055555588b0cf in tcg_cpu_exec (cpu=0x55555686a2f0) at ./cpus.c:1431 -12 0x000055555588d223 in qemu_tcg_cpu_thread_fn (arg=0x55555686a2f0) at ./cpus.c:1735 -13 0x000055555588d223 in qemu_tcg_cpu_thread_fn (arg=arg@entry=0x55555686a2f0) at ./cpus.c:1709 -14 0x0000555555d2629a in qemu_thread_start (args=) at ./util/qemu-thread-posix.c:502 -15 0x00007ffff4db8a92 in start_thread () at /usr/lib/libpthread. - -This patch ensures that we don't hit the abort() in the second switch -case in disas_neon_data_insn() as we will return from the first case. - -Signed-off-by: Alistair Francis -Reviewed-by: Richard Henderson -Reviewed-by: Philippe Mathieu-Daudé -Reviewed-by: Alex Bennée -Tested-by: Alex Bennée -Message-id: ad91b397f360b2fc7f4087e476f7df5b04d42ddb.1558021877.git.alistair.francis@wdc.com -Signed-off-by: Peter Maydell -Upstream-Status: Backport [4.1.0] ---- - target/arm/translate.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/target/arm/translate.c b/target/arm/translate.c -index dd053c80d6..298c262825 100644 ---- a/target/arm/translate.c -+++ b/target/arm/translate.c -@@ -6598,13 +6598,13 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), - rn_ofs, rm_ofs, vec_size, vec_size, - (u ? uqadd_op : sqadd_op) + size); -- break; -+ return 0; - - case NEON_3R_VQSUB: - tcg_gen_gvec_4(rd_ofs, offsetof(CPUARMState, vfp.qc), - rn_ofs, rm_ofs, vec_size, vec_size, - (u ? uqsub_op : sqsub_op) + size); -- break; -+ return 0; - - case NEON_3R_VMUL: /* VMUL */ - if (u) { --- -2.21.0 - diff --git a/meta/recipes-devtools/qemu/qemu/0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch b/meta/recipes-devtools/qemu/qemu/0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch deleted file mode 100644 index 7cac8ef3d1..0000000000 --- a/meta/recipes-devtools/qemu/qemu/0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch +++ /dev/null @@ -1,339 +0,0 @@ -From 8104018ba4c66e568d2583a3a0ee940851ee7471 Mon Sep 17 00:00:00 2001 -From: Daniel P. Berrangé -Date: Tue, 23 Jul 2019 17:50:00 +0200 -Subject: [PATCH] linux-user: fix to handle variably sized SIOCGSTAMP with new - kernels -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The SIOCGSTAMP symbol was previously defined in the -asm-generic/sockios.h header file. QEMU sees that header -indirectly via sys/socket.h - -In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115 -the asm-generic/sockios.h header no longer defines SIOCGSTAMP. -Instead it provides only SIOCGSTAMP_OLD, which only uses a -32-bit time_t on 32-bit architectures. - -The linux/sockios.h header then defines SIOCGSTAMP using -either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. If -SIOCGSTAMP_NEW is used, then the tv_sec field is 64-bit even -on 32-bit architectures - -To cope with this we must now convert the old and new type from -the target to the host one. - -Signed-off-by: Daniel P. Berrangé -Signed-off-by: Laurent Vivier -Reviewed-by: Arnd Bergmann -Message-Id: <20190718130641.15294-1-laurent@vivier.eu> -Signed-off-by: Laurent Vivier -Signed-off-by: Bartosz Golaszewski ---- -Upstream-Status: Backport [upstream commit: 6d5d5dde9adb5acb32e6b8e3dfbf47fff0f308d2] - - linux-user/ioctls.h | 21 +++++- - linux-user/syscall.c | 140 +++++++++++++++++++++++++++++-------- - linux-user/syscall_defs.h | 30 +++++++- - linux-user/syscall_types.h | 6 -- - 4 files changed, 159 insertions(+), 38 deletions(-) - -diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h -index ae8951625f..e6a27ad9d6 100644 ---- a/linux-user/ioctls.h -+++ b/linux-user/ioctls.h -@@ -219,8 +219,25 @@ - IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq))) - IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq))) - IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */ -- IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval))) -- IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec))) -+ -+ /* -+ * We can't use IOCTL_SPECIAL() because it will set -+ * host_cmd to XXX_OLD and XXX_NEW and these macros -+ * are not defined with kernel prior to 5.2. -+ * We must set host_cmd to the same value as in target_cmd -+ * otherwise the consistency check in syscall_init() -+ * will trigger an error. -+ * host_cmd is ignored by the do_ioctl_XXX() helpers. -+ * FIXME: create a macro to define this kind of entry -+ */ -+ { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD, -+ "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP }, -+ { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD, -+ "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS }, -+ { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW, -+ "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP }, -+ { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW, -+ "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS }, - - IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT)) - IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT)) -diff --git a/linux-user/syscall.c b/linux-user/syscall.c -index 96cd4bf86d..6df480e13d 100644 ---- a/linux-user/syscall.c -+++ b/linux-user/syscall.c -@@ -37,6 +37,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1139,8 +1140,9 @@ static inline abi_long copy_from_user_timeval(struct timeval *tv, - { - struct target_timeval *target_tv; - -- if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1)) -+ if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1)) { - return -TARGET_EFAULT; -+ } - - __get_user(tv->tv_sec, &target_tv->tv_sec); - __get_user(tv->tv_usec, &target_tv->tv_usec); -@@ -1155,8 +1157,26 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr, - { - struct target_timeval *target_tv; - -- if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) -+ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) { -+ return -TARGET_EFAULT; -+ } -+ -+ __put_user(tv->tv_sec, &target_tv->tv_sec); -+ __put_user(tv->tv_usec, &target_tv->tv_usec); -+ -+ unlock_user_struct(target_tv, target_tv_addr, 1); -+ -+ return 0; -+} -+ -+static inline abi_long copy_to_user_timeval64(abi_ulong target_tv_addr, -+ const struct timeval *tv) -+{ -+ struct target__kernel_sock_timeval *target_tv; -+ -+ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) { - return -TARGET_EFAULT; -+ } - - __put_user(tv->tv_sec, &target_tv->tv_sec); - __put_user(tv->tv_usec, &target_tv->tv_usec); -@@ -1166,6 +1186,48 @@ static inline abi_long copy_to_user_timeval(abi_ulong target_tv_addr, - return 0; - } - -+static inline abi_long target_to_host_timespec(struct timespec *host_ts, -+ abi_ulong target_addr) -+{ -+ struct target_timespec *target_ts; -+ -+ if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1)) { -+ return -TARGET_EFAULT; -+ } -+ __get_user(host_ts->tv_sec, &target_ts->tv_sec); -+ __get_user(host_ts->tv_nsec, &target_ts->tv_nsec); -+ unlock_user_struct(target_ts, target_addr, 0); -+ return 0; -+} -+ -+static inline abi_long host_to_target_timespec(abi_ulong target_addr, -+ struct timespec *host_ts) -+{ -+ struct target_timespec *target_ts; -+ -+ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) { -+ return -TARGET_EFAULT; -+ } -+ __put_user(host_ts->tv_sec, &target_ts->tv_sec); -+ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec); -+ unlock_user_struct(target_ts, target_addr, 1); -+ return 0; -+} -+ -+static inline abi_long host_to_target_timespec64(abi_ulong target_addr, -+ struct timespec *host_ts) -+{ -+ struct target__kernel_timespec *target_ts; -+ -+ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) { -+ return -TARGET_EFAULT; -+ } -+ __put_user(host_ts->tv_sec, &target_ts->tv_sec); -+ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec); -+ unlock_user_struct(target_ts, target_addr, 1); -+ return 0; -+} -+ - static inline abi_long copy_from_user_timezone(struct timezone *tz, - abi_ulong target_tz_addr) - { -@@ -4790,6 +4852,54 @@ static abi_long do_ioctl_kdsigaccept(const IOCTLEntry *ie, uint8_t *buf_temp, - return get_errno(safe_ioctl(fd, ie->host_cmd, sig)); - } - -+static abi_long do_ioctl_SIOCGSTAMP(const IOCTLEntry *ie, uint8_t *buf_temp, -+ int fd, int cmd, abi_long arg) -+{ -+ struct timeval tv; -+ abi_long ret; -+ -+ ret = get_errno(safe_ioctl(fd, SIOCGSTAMP, &tv)); -+ if (is_error(ret)) { -+ return ret; -+ } -+ -+ if (cmd == (int)TARGET_SIOCGSTAMP_OLD) { -+ if (copy_to_user_timeval(arg, &tv)) { -+ return -TARGET_EFAULT; -+ } -+ } else { -+ if (copy_to_user_timeval64(arg, &tv)) { -+ return -TARGET_EFAULT; -+ } -+ } -+ -+ return ret; -+} -+ -+static abi_long do_ioctl_SIOCGSTAMPNS(const IOCTLEntry *ie, uint8_t *buf_temp, -+ int fd, int cmd, abi_long arg) -+{ -+ struct timespec ts; -+ abi_long ret; -+ -+ ret = get_errno(safe_ioctl(fd, SIOCGSTAMPNS, &ts)); -+ if (is_error(ret)) { -+ return ret; -+ } -+ -+ if (cmd == (int)TARGET_SIOCGSTAMPNS_OLD) { -+ if (host_to_target_timespec(arg, &ts)) { -+ return -TARGET_EFAULT; -+ } -+ } else{ -+ if (host_to_target_timespec64(arg, &ts)) { -+ return -TARGET_EFAULT; -+ } -+ } -+ -+ return ret; -+} -+ - #ifdef TIOCGPTPEER - static abi_long do_ioctl_tiocgptpeer(const IOCTLEntry *ie, uint8_t *buf_temp, - int fd, int cmd, abi_long arg) -@@ -6160,32 +6270,6 @@ static inline abi_long target_ftruncate64(void *cpu_env, abi_long arg1, - } - #endif - --static inline abi_long target_to_host_timespec(struct timespec *host_ts, -- abi_ulong target_addr) --{ -- struct target_timespec *target_ts; -- -- if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1)) -- return -TARGET_EFAULT; -- __get_user(host_ts->tv_sec, &target_ts->tv_sec); -- __get_user(host_ts->tv_nsec, &target_ts->tv_nsec); -- unlock_user_struct(target_ts, target_addr, 0); -- return 0; --} -- --static inline abi_long host_to_target_timespec(abi_ulong target_addr, -- struct timespec *host_ts) --{ -- struct target_timespec *target_ts; -- -- if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) -- return -TARGET_EFAULT; -- __put_user(host_ts->tv_sec, &target_ts->tv_sec); -- __put_user(host_ts->tv_nsec, &target_ts->tv_nsec); -- unlock_user_struct(target_ts, target_addr, 1); -- return 0; --} -- - static inline abi_long target_to_host_itimerspec(struct itimerspec *host_itspec, - abi_ulong target_addr) - { -diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h -index 12c8407144..c918419306 100644 ---- a/linux-user/syscall_defs.h -+++ b/linux-user/syscall_defs.h -@@ -208,16 +208,34 @@ struct target_linger { - abi_int l_linger; /* How long to linger for */ - }; - -+#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) -+struct target_timeval { -+ abi_long tv_sec; -+ abi_int tv_usec; -+}; -+#define target__kernel_sock_timeval target_timeval -+#else - struct target_timeval { - abi_long tv_sec; - abi_long tv_usec; - }; - -+struct target__kernel_sock_timeval { -+ abi_llong tv_sec; -+ abi_llong tv_usec; -+}; -+#endif -+ - struct target_timespec { - abi_long tv_sec; - abi_long tv_nsec; - }; - -+struct target__kernel_timespec { -+ abi_llong tv_sec; -+ abi_llong tv_nsec; -+}; -+ - struct target_timezone { - abi_int tz_minuteswest; - abi_int tz_dsttime; -@@ -743,8 +761,16 @@ struct target_pollfd { - #define TARGET_SIOCATMARK 0x8905 - #define TARGET_SIOCGPGRP 0x8904 - #endif --#define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ --#define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ -+#if defined(TARGET_SH4) -+#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval) -+#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec) -+#else -+#define TARGET_SIOCGSTAMP_OLD 0x8906 -+#define TARGET_SIOCGSTAMPNS_OLD 0x8907 -+#endif -+ -+#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2]) -+#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2]) - - /* Networking ioctls */ - #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ -diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h -index b98a23b0f1..4e36983826 100644 ---- a/linux-user/syscall_types.h -+++ b/linux-user/syscall_types.h -@@ -14,12 +14,6 @@ STRUCT(serial_icounter_struct, - STRUCT(sockaddr, - TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 14)) - --STRUCT(timeval, -- MK_ARRAY(TYPE_LONG, 2)) -- --STRUCT(timespec, -- MK_ARRAY(TYPE_LONG, 2)) -- - STRUCT(rtentry, - TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), - TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID, --- -2.21.0 - diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2019-12155.patch b/meta/recipes-devtools/qemu/qemu/CVE-2019-12155.patch deleted file mode 100644 index c49a5e9a2a..0000000000 --- a/meta/recipes-devtools/qemu/qemu/CVE-2019-12155.patch +++ /dev/null @@ -1,35 +0,0 @@ -From d52680fc932efb8a2f334cc6993e705ed1e31e99 Mon Sep 17 00:00:00 2001 -From: Prasad J Pandit -Date: Thu, 25 Apr 2019 12:05:34 +0530 -Subject: [PATCH] qxl: check release info object - -When releasing spice resources in release_resource() routine, -if release info object 'ext.info' is null, it leads to null -pointer dereference. Add check to avoid it. - -Reported-by: Bugs SysSec -Signed-off-by: Prasad J Pandit -Message-id: 20190425063534.32747-1-ppandit@redhat.com -Signed-off-by: Gerd Hoffmann - -Upstream-Status: Backport -CVE: CVE-2019-12155 -Signed-off-by: Anuj Mittal ---- - hw/display/qxl.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/hw/display/qxl.c b/hw/display/qxl.c -index c8ce5781e03..632923add23 100644 ---- a/hw/display/qxl.c -+++ b/hw/display/qxl.c -@@ -777,6 +777,9 @@ static void interface_release_resource(QXLInstance *sin, - QXLReleaseRing *ring; - uint64_t *item, id; - -+ if (!ext.info) { -+ return; -+ } - if (ext.group_id == MEMSLOT_GROUP_HOST) { - /* host group -> vga mode update request */ - QXLCommandExt *cmdext = (void *)(intptr_t)(ext.info->id); diff --git a/meta/recipes-devtools/qemu/qemu_4.0.0.bb b/meta/recipes-devtools/qemu/qemu_4.0.0.bb deleted file mode 100644 index 76776098d0..0000000000 --- a/meta/recipes-devtools/qemu/qemu_4.0.0.bb +++ /dev/null @@ -1,21 +0,0 @@ -BBCLASSEXTEND = "nativesdk" - -require qemu.inc - -DEPENDS = "glib-2.0 zlib pixman bison-native" - -RDEPENDS_${PN}_class-target += "bash" - -EXTRA_OECONF_append_class-target = " --target-list=${@get_qemu_target_list(d)}" -EXTRA_OECONF_append_class-target_mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" -EXTRA_OECONF_append_class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" - -do_install_append_class-nativesdk() { - ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} -} - -PACKAGECONFIG ??= " \ - fdt sdl kvm \ - ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ -" -PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm" diff --git a/meta/recipes-devtools/qemu/qemu_4.1.0.bb b/meta/recipes-devtools/qemu/qemu_4.1.0.bb new file mode 100644 index 0000000000..76776098d0 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu_4.1.0.bb @@ -0,0 +1,21 @@ +BBCLASSEXTEND = "nativesdk" + +require qemu.inc + +DEPENDS = "glib-2.0 zlib pixman bison-native" + +RDEPENDS_${PN}_class-target += "bash" + +EXTRA_OECONF_append_class-target = " --target-list=${@get_qemu_target_list(d)}" +EXTRA_OECONF_append_class-target_mipsarcho32 = "${@bb.utils.contains('BBEXTENDCURR', 'multilib', ' --disable-capstone', '', d)}" +EXTRA_OECONF_append_class-nativesdk = " --target-list=${@get_qemu_target_list(d)}" + +do_install_append_class-nativesdk() { + ${@bb.utils.contains('PACKAGECONFIG', 'gtk+', 'make_qemu_wrapper', '', d)} +} + +PACKAGECONFIG ??= " \ + fdt sdl kvm \ + ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \ +" +PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm" -- cgit v1.2.3-54-g00ecf