aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-01-25net: Fix handling of id in netdev_add and netdev_delMarkus Armbruster
CLI -netdev accumulates in option group "netdev". Before commit 08712fcb85 "net: Track netdevs in NetClientState rather than QemuOpt", netdev_add added to the option group, and netdev_del removed from it, both HMP and QMP. Thus, every netdev had a corresponding QemuOpts in this option group. Commit 08712fcb85 dropped this for QMP netdev_add and both netdev_del. Now a netdev has a corresponding QemuOpts only when it was created with CLI or HMP. Two issues: * QMP and HMP netdev_del can leave QemuOpts behind, breaking HMP netdev_add. Reproducer: $ qemu-system-x86_64 -S -display none -nodefaults -monitor stdio QEMU 5.1.92 monitor - type 'help' for more information (qemu) netdev_add user,id=net0 (qemu) info network net0: index=0,type=user,net=10.0.2.0,restrict=off (qemu) netdev_del net0 (qemu) info network (qemu) netdev_add user,id=net0 upstream-qemu: Duplicate ID 'net0' for netdev Try "help netdev_add" for more information Fix by restoring the QemuOpts deletion in qmp_netdev_del(), but with a guard, because the QemuOpts need not exist. * QMP netdev_add loses its "no duplicate ID" check. Reproducer: $ qemu-system-x86_64 -S -display none -qmp stdio {"QMP": {"version": {"qemu": {"micro": 92, "minor": 1, "major": 5}, "package": "v5.2.0-rc2-1-g02c1f0142c"}, "capabilities": ["oob"]}} {"execute": "qmp_capabilities"} {"return": {}} {"execute": "netdev_add", "arguments": {"type": "user", "id":"net0"}} {"return": {}} {"execute": "netdev_add", "arguments": {"type": "user", "id":"net0"}} {"return": {}} Fix by adding a duplicate ID check to net_client_init1() to replace the lost one. The check is redundant for callers where QemuOpts still checks, i.e. for CLI and HMP. Reported-by: Andrew Melnichenko <andrew@daynix.com> Fixes: 08712fcb851034228b61f75bd922863a984a4f60 Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
2021-01-23Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into ↵Peter Maydell
staging * Make MinGW respect --bindir (Joshua) * Switch MinGW to a "deep" installation (Joshua + NSIS fixes by myself) * Fix compilation errors/warnings (Qixin, Philippe) * QemuOpts cleanups (myself) * Consistency improvements for -action (myself) * remove deprecated "change vnc TARGET" functionality (myself) * meson cleanups (Marc-André, Philippe, myself) * IDE out-of-bounds access (Prasad) * LA57 fix for -cpu max (Weijiang) # gpg: Signature made Sat 23 Jan 2021 20:55:59 GMT # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (30 commits) qemu-option: warn for short-form boolean options qemu-option: move help handling to get_opt_name_value qemu-option: clean up id vs. list->merge_lists vnc: support "-vnc help" qmp: remove deprecated "change" command hmp: remove "change vnc TARGET" command acceptance: switch to QMP change-vnc-password command meson.build: Detect bzip2 program meson.build: Declare global edk2_targets / install_edk2_blobs variables meson: Add a section header for library dependencies meson: Display crypto-related information altogether meson: Display block layer information altogether meson: Display accelerators and selected targets altogether meson: Summarize compilation-related information altogether meson: Summarize overall features altogether meson: Display host binaries information altogether meson: Summarize information related to directories first meson: convert wixl detection to Meson nsis: adjust for new MinGW paths meson: Declare have_virtfs_proxy_helper in main meson.build ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-23qemu-option: warn for short-form boolean optionsPaolo Bonzini
Options such as "server" or "nowait", that are commonly found in -chardev, are sugar for "server=on" and "wait=off". This is quite surprising and also does not have any notion of typing attached. It is even possible to do "-device e1000,noid" and get a device with "id=off". Deprecate it and print a warning when it is encountered. In general, this short form for boolean options only seems to be in wide use for -chardev and -spice. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23qemu-option: move help handling to get_opt_name_valuePaolo Bonzini
Right now, help options are parsed normally and then checked specially in opt_validate, but only if coming from qemu_opts_parse_noisily. has_help_option does the check on its own. opt_validate() has two callers: qemu_opt_set(), which passes null and is therefore unaffected, and opts_do_parse(), which is affected. opts_do_parse() is called by qemu_opts_do_parse(), which passes null and is therefore unaffected, and opts_parse(). opts_parse() is called by qemu_opts_parse() and qemu_opts_set_defaults(), which pass null and are therefore unaffected, and qemu_opts_parse_noisily(). Move the check from opt_validate to the parsing workhorse of QemuOpts, get_opt_name_value. This will come in handy in the next patch, which will raise a warning for "-object memory-backend-ram,share" ("flag" option with no =on/=off part) but not for "-object memory-backend-ram,help". As a result: - opts_parse and opts_do_parse do not return an error anymore when help is requested; qemu_opts_parse_noisily does not have to work around that anymore. - various crazy ways to request help are not recognized anymore: - "help=..." - "nohelp" (sugar for "help=off") - "?=..." - "no?" (sugar for "?=off") - "help" would be recognized as help request even if there is a (foolishly named) parameter "help". No such parameters exist, though. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23qemu-option: clean up id vs. list->merge_listsPaolo Bonzini
Looking at all merge-lists QemuOptsList, here is how they access their QemuOpts: reopen_opts in qemu-io-cmds.c ("qemu-img reopen -o") qemu_opts_find(&reopen_opts, NULL) empty_opts in qemu-io.c ("qemu-io open -o") qemu_opts_find(&empty_opts, NULL) qemu_rtc_opts ("-rtc") qemu_find_opts_singleton("rtc") qemu_machine_opts ("-M") qemu_find_opts_singleton("machine") qemu_action_opts ("-name") qemu_opts_foreach->process_runstate_actions qemu_boot_opts ("-boot") in hw/nvram/fw_cfg.c and hw/s390x/ipl.c: QTAILQ_FIRST(&qemu_find_opts("bootopts")->head) in softmmu/vl.c: qemu_opts_find(qemu_find_opts("boot-opts"), NULL) qemu_name_opts ("-name") qemu_opts_foreach->parse_name parse_name does not use id qemu_mem_opts ("-m") qemu_find_opts_singleton("memory") qemu_icount_opts ("-icount") qemu_opts_foreach->do_configure_icount do_configure_icount->icount_configure icount_configure does not use id qemu_smp_opts ("-smp") qemu_opts_find(qemu_find_opts("smp-opts"), NULL) qemu_spice_opts ("-spice") QTAILQ_FIRST(&qemu_spice_opts.head) i.e. they don't need an id. Sometimes its presence is ignored (e.g. when using qemu_opts_foreach), sometimes all the options with the id are skipped, sometimes only the first option on the command line is considered. -boot does two different things depending on who's looking at the options. With this patch we just forbid id on merge-lists QemuOptsLists; if the command line still works, it has the same semantics as before. qemu_opts_create's fail_if_exists parameter is now unnecessary: - it is unused if id is NULL - opts_parse only passes false if reached from qemu_opts_set_defaults, in which case this patch enforces that id must be NULL - other callers that can pass a non-NULL id always set it to true Assert that it is true in the only case where "fail_if_exists" matters, i.e. "id && !lists->merge_lists". This means that if an id is present, duplicates are always forbidden, which was already the status quo. Discounting the case that aborts as it's not user-controlled (it's "just" a matter of inspecting qemu_opts_create callers), the paths through qemu_opts_create can be summarized as: - merge_lists = true: singleton opts with NULL id; non-NULL id fails - merge_lists = false: always return new opts; non-NULL id fails if dup Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23vnc: support "-vnc help"Paolo Bonzini
Use qemu_opts_parse_noisily now that HMP does not call vnc_parse anymore. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20210120144235.345983-4-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23qmp: remove deprecated "change" commandPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210120144235.345983-3-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23hmp: remove "change vnc TARGET" commandPaolo Bonzini
The HMP command \"change vnc TARGET\" is messy: - it takes an ugly shortcut to determine if the option has an "id", with incorrect results if "id=" is not preceded by an unescaped comma. - it deletes the existing QemuOpts and does not try to rollback if the parsing fails (which is not causing problems, but only due to how VNC options are parsed) - because it uses the same parsing function as "-vnc", it forces the latter to not support "-vnc help". On top of this, it uses a deprecated QMP command, thus getting in the way of removing the QMP command. Since the usecase for the command is not clear, just remove it and send "change vnc password" directly to the QMP "change-vnc-password" command. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20210120144235.345983-2-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23acceptance: switch to QMP change-vnc-password commandPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson.build: Detect bzip2 programPhilippe Mathieu-Daudé
The --enable-bzip2/--disable-bzip2 configure arguments are somehow misleading, they check for the bzip2 library, not the bzip2 program. We need the bzip2 program to install the EDK2 firmware blobs (see commit 623ef637a2e "configure: Check bzip2 is available"). Check if the bzip2 program in the global meson.build to avoid the configuration to succeed, but a later when trying to install the firmware blobs: ../pc-bios/meson.build:5:2: ERROR: Program 'bzip2' not found Reported-by: John Snow <jsnow@redhat.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Fixes: c8d5450bba3 ("configure: move install_blobs from configure to meson") Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210114174509.2944817-3-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson.build: Declare global edk2_targets / install_edk2_blobs variablesPhilippe Mathieu-Daudé
Globally declare in the main meson.build: - the list of EDK2 targets, - whether the EDK2 blobs have to be installed. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210114174509.2944817-2-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Add a section header for library dependenciesPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-9-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Display crypto-related information altogetherPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-8-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Display block layer information altogetherPhilippe Mathieu-Daudé
Display block layer information altogether, when it is relevant. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-7-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Display accelerators and selected targets altogetherPhilippe Mathieu-Daudé
Display accelerators and selected targets altogether, avoid to display unuseful information when not relevant. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-6-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Summarize compilation-related information altogetherPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-5-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Summarize overall features altogetherPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-4-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Display host binaries information altogetherPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-3-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Summarize information related to directories firstPhilippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210121095616.1471869-2-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: convert wixl detection to MesonPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23nsis: adjust for new MinGW pathsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23meson: Declare have_virtfs_proxy_helper in main meson.buildPhilippe Mathieu-Daudé
have_virtfs_proxy_helper is used from docs/meson.build, and can be not declared when including it before fsdev/meson.build. This fixes: ../docs/meson.build:54:2: ERROR: Unknown variable "have_virtfs_proxy_helper". Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210120151539.1166252-1-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23Merge remote-tracking branch 'remotes/kraxel/tags/usb-20210122-pull-request' ↵Peter Maydell
into staging usb: cleanups and fixes. usb: add pcap support. # gpg: Signature made Fri 22 Jan 2021 17:48:35 GMT # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20210122-pull-request: usb-host: map LIBUSB_SPEED_SUPER_PLUS to USB_SPEED_SUPER usb: add pcap support. hw/usb/dev-uas: Report command additional adb length as unsupported scsi/utils: Add INVALID_PARAM_VALUE sense code definition hw/usb/hcd-xhci: Fix extraneous format-truncation error on 32-bit hosts hw/usb: Convert to qdev_realize() hw/usb: Fix bad printf format specifiers hw/usb/host-libusb.c: fix build with kernel < 5.0 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-23build-sys: add libvhost-user missing dependenciesMarc-André Lureau
This help fixing static compilation issues. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210114125605.1227742-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23build-sys: set global arguments for cflags/ldflagsMarc-André Lureau
As we want subprojects to share those arguments Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210114125605.1227742-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23build-sys: remove unused LIBSMarc-André Lureau
Since meson switch and commit feabc71dfa58 ("configure: do not include dependency flags in QEMU_CFLAGS and LIBS"), LIBS is unused. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210114125605.1227742-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23ide: atapi: check logical block address and read size (CVE-2020-29443)Prasad J Pandit
While processing ATAPI cmd_read/cmd_read_cd commands, Logical Block Address (LBA) maybe invalid OR closer to the last block, leading to an OOB access issues. Add range check to avoid it. Fixes: CVE-2020-29443 Reported-by: Wenxiang Qian <leonwxqian@gmail.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-Id: <20210118115130.457044-1-ppandit@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-23softmmu/physmem: Silence GCC 10 maybe-uninitialized errorPhilippe Mathieu-Daudé
When building with GCC 10.2 configured with --extra-cflags=-Os, we get: softmmu/physmem.c: In function 'address_space_translate_for_iotlb': softmmu/physmem.c:643:26: error: 'notifier' may be used uninitialized in this function [-Werror=maybe-uninitialized] 643 | notifier->active = true; | ^ softmmu/physmem.c:608:23: note: 'notifier' was declared here 608 | TCGIOMMUNotifier *notifier; | ^~~~~~~~ Initialize 'notifier' to silence the warning. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210117170411.4106949-1-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-22usb-host: map LIBUSB_SPEED_SUPER_PLUS to USB_SPEED_SUPERGerd Hoffmann
Handle host superspeedplus (usb 3.1+) devices like superspeed (usb 3.0) devices. That is enough to get them handled properly by xhci. They show up as superspeed devices inside the guest, but should be able to actually run at higher speeds. Reported-by: Angel Pagan <Angel.Pagan@stratus.com> Tested-by: Angel Pagan <Angel.Pagan@stratus.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20210121150832.3564097-1-kraxel@redhat.com>
2021-01-22usb: add pcap support.Gerd Hoffmann
Log all traffic of a specific usb device to a pcap file for later inspection. File format is compatible with linux usb monitor. Usage: qemu -device usb-${somedevice},pcap=file.pcap wireshark file.pcap Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210119194452.2148048-1-kraxel@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22hw/usb/dev-uas: Report command additional adb length as unsupportedPhilippe Mathieu-Daudé
We are not ready to handle additional CDB data. If a guest sends a packet with such additional data, report the command parameter as not supported. Specify a size (of 1 byte) for the add_cdb member we are not using, to fix the following warning: usb/dev-uas.c:157:31: error: field 'status' with variable sized type 'uas_iu' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] uas_iu status; ^ Reported-by: Ed Maste <emaste@FreeBSD.org> Reported-by: Daniele Buono <dbuono@linux.vnet.ibm.com> Reported-by: Han Han <hhan@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210120153522.1173897-4-philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22scsi/utils: Add INVALID_PARAM_VALUE sense code definitionPhilippe Mathieu-Daudé
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210120153522.1173897-3-philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22hw/usb/hcd-xhci: Fix extraneous format-truncation error on 32-bit hostsPhilippe Mathieu-Daudé
For some reason the assert() added in commit ccb799313a5 ("hw/usb: avoid format truncation warning when formatting port name") does not fix when building with GCC 10. KISS and expand the buffer by 4 bytes to silent the following error when using GCC 10.2.1 on Fedora 33: hw/usb/hcd-xhci.c: In function 'usb_xhci_realize': hw/usb/hcd-xhci.c:3309:54: error: '%d' directive output may be truncated writing between 1 and 8 bytes into a region of size 5 [-Werror=format-truncation=] 3309 | snprintf(port->name, sizeof(port->name), "usb2 port #%d", i+1); | ^~~~~~~~~~~~~~~ hw/usb/hcd-xhci.c:3309:54: note: directive argument in the range [1, 89478486] In file included from /usr/include/stdio.h:866, from include/qemu/osdep.h:85, from hw/usb/hcd-xhci.c:22: /usr/include/bits/stdio2.h:70:10: note: '__builtin___snprintf_chk' output between 13 and 20 bytes into a destination of size 16 70 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ hw/usb/hcd-xhci.c:3323:54: error: '%d' directive output may be truncated writing between 1 and 8 bytes into a region of size 5 [-Werror=format-truncation=] 3323 | snprintf(port->name, sizeof(port->name), "usb3 port #%d", i+1); | ^~~~~~~~~~~~~~~ hw/usb/hcd-xhci.c:3323:54: note: directive argument in the range [1, 89478486] In file included from /usr/include/stdio.h:866, from include/qemu/osdep.h:85, from hw/usb/hcd-xhci.c:22: /usr/include/bits/stdio2.h:70:10: note: '__builtin___snprintf_chk' output between 13 and 20 bytes into a destination of size 16 70 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210118181115.313742-1-philmd@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22hw/usb: Convert to qdev_realize()Markus Armbruster
Device code shouldn't mess with QOM property "realized" since we have proper interfaces (merge commit 6675a653). Commit 8ddab8dd3d "usb/hcd-xhci: Split pci wrapper for xhci base model" and commit f00ff136ee "usb: hcd-xhci-sysbus: Attach xhci to sysbus device" reintroduced two instances. Clean them up. Note that s->xhci is a (bus-less) TYPE_XHCI device. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210119120151.53757-1-armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22hw/usb: Fix bad printf format specifiersAlex Chen
We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Alex Chen <alex.chen@huawei.com> Message-id: 20201119025751.45750-1-alex.chen@huawei.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22hw/usb/host-libusb.c: fix build with kernel < 5.0Fabrice Fontaine
USBDEVFS_GET_SPEED is used since version 5.2.0 and https://gitlab.com/qemu-project/qemu/-/commit/202d69a715a4b1824dcd7ec1683d027ed2bae6d3 resulting in the following build failure with kernel < 5.0: ../hw/usb/host-libusb.c: In function 'usb_host_open': ../hw/usb/host-libusb.c:953:32: error: 'USBDEVFS_GET_SPEED' undeclared (first use in this function); did you mean 'USBDEVFS_GETDRIVER'? int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL); ^~~~~~~~~~~~~~~~~~ USBDEVFS_GETDRIVER A tentative was made to fix this build failure with https://gitlab.com/qemu-project/qemu/-/commit/4969e697c15ac536d5c0700381d5d026ef7f0588 However, the assumption that distros with old kernels also have old libusb is just wrong so also add a check for defined(USBDEVFS_GET_SPEED) Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Message-id: 20201213213016.457350-1-fontaine.fabrice@gmail.com [ kraxel: codestyle whitespace fixup ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-01-22Merge remote-tracking branch ↵Peter Maydell
'remotes/vivier2/tags/linux-user-for-6.0-pull-request' into staging linux-user pull request 20210119-v3 Remove obsolete F_SHLCK and F_EXLCK translation Update sockopt Add F_ADD_SEALS and F_GET_SEALS # gpg: Signature made Thu 21 Jan 2021 12:33:04 GMT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-6.0-pull-request: linux-user: Remove obsolete F_SHLCK and F_EXLCK translation linux-user: Add IPv6 options to do_print_sockopt() linux-user: add missing IPv6 get/setsockopt option linux-user: add missing UDP get/setsockopt option linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-21Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210121' ↵Peter Maydell
into staging s390x updates: - headers update to Linux 5.11-rc2 - fix tcg emulation for some instructions that are generated by clang Linux kernel builds - vfio-ccw: wire up the device unplug notification mechanism - fix a gcc 11 warning # gpg: Signature made Thu 21 Jan 2021 12:08:12 GMT # gpg: using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF # gpg: issuer "cohuck@redhat.com" # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown] # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full] # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full] # gpg: aka "Cornelia Huck <cohuck@kernel.org>" [unknown] # gpg: aka "Cornelia Huck <cohuck@redhat.com>" [unknown] # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck-gitlab/tags/s390x-20210121: s390x: Use strpadcpy for copying vm name vfio-ccw: Connect the device request notifier Update linux headers to 5.11-rc2 update-linux-headers: Include const.h s390x/tcg: Ignore register content if b1/b2 is zero when handling EXECUTE tests/tcg/s390x: Fix EXRL tests s390x/tcg: Don't ignore content in r0 when not specified via "b" or "x" s390x/tcg: Fix RISBHG s390x/tcg: Fix ALGSI Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-21linux-user: Remove obsolete F_SHLCK and F_EXLCK translationMichael Forney
These lock types are unsupported by Linux since v2.2[0][1] and always return EINVAL (except on SPARC up until v2.6, which just warned). musl libc does not define these constants, so just remove them from the translation cases. [0] https://github.com/mpe/linux-fullhistory/blob/v2.2.0/fs/locks.c#L322-L324 [1] https://github.com/mpe/linux-fullhistory/blob/v2.2.0/fs/locks.c#L429-L445 Signed-off-by: Michael Forney <mforney@mforney.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20210114223602.9004-1-mforney@mforney.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-01-21linux-user: Add IPv6 options to do_print_sockopt()Shu-Chun Weng
Signed-off-by: Shu-Chun Weng <scw@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20201218193213.3566856-5-scw@google.com> [lv: Add missing <linux/in6.h> include for IPV6_ADDR_PREFERENCES] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-01-21util/cacheflush: Fix error generated by clangGan Qixin
When compiling qemu-fuzz-i386 on aarch64 host, clang reported the following error: ../util/cacheflush.c:38:44: error: value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths] asm volatile("mrs\t%0, ctr_el0" : "=r"(save_ctr_el0)); ^ ../util/cacheflush.c:38:24: note: use constraint modifier "w" asm volatile("mrs\t%0, ctr_el0" : "=r"(save_ctr_el0)); ^~ %w0 Modify the type of save_ctr_el0 to uint64_t to fix it. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Gan Qixin <ganqixin@huawei.com> Message-Id: <20210115075656.717957-1-ganqixin@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-01-21build-system: clean up TCG/TCI configuryPaolo Bonzini
Make CONFIG_TCG_INTERPRETER a Meson option, and enable TCI (though with a warning) if the host CPU is unsupported, making it more similar to other --enable-* options. Remove TCG-specific include paths from !CONFIG_TCG builds. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-21x86/cpu: Use max host physical address if -cpu max option is appliedYang Weijiang
QEMU option -cpu max(max_features) means "Enables all features supported by the accelerator in the current host", this looks true for all the features except guest max physical address width, so add this patch to enable it. Signed-off-by: Yang Weijiang <weijiang.yang@intel.com> Message-Id: <20210113090430.26394-1-weijiang.yang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-21configure: MinGW respect --bindir argumentJoshua Watt
There are two cases that need to be accounted for when compiling QEMU for MinGW32: 1) A standalone distribution, where QEMU is self contained and extracted by the user, such as a user would download from the QEMU website. In this case, all the QEMU executable files should be rooted in $prefix to ensure they can be easily found by the user 2) QEMU integrated into a distribution image/sysroot/SDK and distributed with other programs. In this case, the provided arguments for bindir/datadir/etc. should be respected as they for a Linux build. Restructures the MinGW path configuration so that all of the paths except bindir use the same rules as when building for other platforms. This satisfies #2 and #1 since these files do not need to be directly in $prefix anyway. The handling for --bindir is changed so that it defaults to $prefix on MinGW (maintaining the compatibility with #1), but if the user specifies a specific path when configuring it can also satisfy #2. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Message-Id: <20210112210239.28836-1-JPEWhacker@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-21runstate: cleanup reboot and panic actionsPaolo Bonzini
The possible choices for panic, reset and watchdog actions are inconsistent. "-action panic=poweroff" should be renamed to "-action panic=shutdown" on the command line. This is because "-action panic=poweroff" and "-action watchdog=poweroff" have slightly different semantics, the first does an unorderly exit while the second goes through qemu_cleanup(). With this change, -no-shutdown would not have to change "-action panic=pause" "pause", just like it does not have to change the reset action. "-action reboot=none" should be renamed to "-action reboot=reset". This should be self explanatory, since for example "-action panic=none" lets the guest proceed without taking any action. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-21Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2021-01-20' into ↵Peter Maydell
staging nbd patches for 2021-01-20 - minor resource leak fixes in qemu-nbd - ensure proper aio context when nbd server uses iothreads - iotest refactorings in preparation for rewriting ./check to be more flexible, and preparing for more nbd server reconnect features # gpg: Signature made Thu 21 Jan 2021 02:28:19 GMT # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2021-01-20: iotests.py: qemu_io(): reuse qemu_tool_pipe_and_status() iotests.py: fix qemu_tool_pipe_and_status() iotests/264: fix style iotests: define group in each iotest iotests/294: add shebang line iotests: make tests executable iotests: fix some whitespaces in test output files iotests/303: use dot slash for qcow2.py running iotests/277: use dot slash for nbd-fault-injector.py running nbd/server: Quiesce coroutines on context switch block: Honor blk_set_aio_context() context requirements qemu-nbd: Fix a memleak in nbd_client_thread() qemu-nbd: Fix a memleak in qemu_nbd_client_list() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-01-21s390x: Use strpadcpy for copying vm nameMiroslav Rezanina
Using strncpy with length equal to the size of target array, GCC 11 reports following warning: warning: '__builtin_strncpy' specified bound 256 equals destination size [-Wstringop-truncation] We can prevent this warning by using strpadcpy that copies string up to specified length, zeroes target array after copied string and does not raise warning when length is equal to target array size (and ending '\0' is discarded). Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <6f86915755219cf6a671788075da4809b57f7d7b.1610607906.git.mrezanin@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2021-01-21vfio-ccw: Connect the device request notifierEric Farman
Now that the vfio-ccw code has a notifier interface to request that a device be unplugged, let's wire that together. Signed-off-by: Eric Farman <farman@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20210104202057.48048-4-farman@linux.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2021-01-21Update linux headers to 5.11-rc2Eric Farman
Signed-off-by: Eric Farman <farman@linux.ibm.com> Message-Id: <20210104202057.48048-3-farman@linux.ibm.com> [CH: dropped qatomic->atomic changes in pvrdma_ring.h] Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2021-01-21update-linux-headers: Include const.hEric Farman
Kernel commit a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to <linux/const.h>") breaks our script because of the unrecognized include. Let's add that to our processing. Signed-off-by: Eric Farman <farman@linux.ibm.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210104202057.48048-2-farman@linux.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>