Patch Round-up for stable 3.1.1, freeze on 2019-07-29
Subsystems (2)
cover Patch Round-up for stable 3.1.1, freeze on 2019-07-29
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
https://github.com/mdroth/qemu/commits/stable-3.1-staging
The release is planned for 2019-08-01:
https://wiki.qemu.org/Planning/3.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Thanks!
PATCH 1/36 i2c: Move typedef of bitbang_i2c_interface to i2c.h
From: BALATON Zoltan <[email protected]>
Clang 3.4 considers duplicate typedef in ppc4xx_i2c.h and bitbang_i2c.h an error even if they are identical. Move it to a common place to allow building with this clang version.
--- hw/i2c/bitbang_i2c.h | 2 -- include/hw/i2c/i2c.h | 2 ++ include/hw/i2c/ppc4xx_i2c.h | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-)
hw/i2c/bitbang_i2c.h +0 -2
@@ -3,8 +3,6 @@#include "hw/i2c/i2c.h" -typedef struct bitbang_i2c_interface bitbang_i2c_interface ; -#define BITBANG_I2C_SDA 0#define BITBANG_I2C_SCL 1
include/hw/i2c/i2c.h +2 -0
@@ -82,6 +82,8 @@ int i2c_recv(I2CBus *bus);DeviceState *i2c_create_slave (I2CBus *bus,const char *name,uint8_t addr); +typedef struct bitbang_i2c_interface bitbang_i2c_interface ; +/* lm832x.c */ void lm832x_key_event (DeviceState *dev,int key,int state);
include/hw/i2c/ppc4xx_i2c.h +0 -3
@@ -31,9 +31,6 @@#include "hw/sysbus.h" #include "hw/i2c/i2c.h" -/* from hw/i2c/bitbang_i2c.h */ -typedef struct bitbang_i2c_interface bitbang_i2c_interface ; -#define TYPE_PPC4xx_I2C "ppc4xx-i2c"#define PPC4xx_I2C (obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 01/36] i2c: Move typedef of bitbang_i2c_interface to i2c.h
Quoted 6 lines · Michael Roth
From: BALATON Zoltan <[email protected]>
Clang 3.4 considers duplicate typedef in
ppc4xx_i2c.handbitbang_i2c.han error even if they are identical. Move it to a common place to allow building with this clang version.
Quoted 6 lines
Reported-by Thomas Huth <[email protected]>Signed-off-by BALATON Zoltan <[email protected]>Acked-by David Gibson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Thomas Huth <[email protected]>(cherry picked from commit 2b4c1125ac3db2734222ff43c25388a16aca4a99)
This was superseded by d718b7475 later so you may want to look at that instead but for stable branch I'm not sure what are your preferences.
Regards,
BALATON Zoltan
Quoted 48 lines
Signed-off-by Michael Roth <[email protected]>---
hw/i2c/bitbang_i2c.h | 2 -- include/hw/i2c/i2c.h | 2 ++ include/hw/i2c/ppc4xx_i2c.h | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-)hw/i2c/bitbang_i2c.h +0
-2@@ -3,8 +3,6 @@#include "hw/i2c/i2c.h" -typedef struct bitbang_i2c_interface bitbang_i2c_interface ; -#define BITBANG_I2C_SDA 0#define BITBANG_I2C_SCL 1include/hw/i2c/i2c.h +2
-0@@ -82,6 +82,8 @@ int i2c_recv(I2CBus *bus);DeviceState *i2c_create_slave (I2CBus *bus,const char *name,uint8_t addr); +typedef struct bitbang_i2c_interface bitbang_i2c_interface ; +/* lm832x.c */ void lm832x_key_event (DeviceState *dev,int key,int state);include/hw/i2c/ppc4xx_i2c.h +0
-3@@ -31,9 +31,6 @@#include "hw/sysbus.h" #include "hw/i2c/i2c.h" -/* from hw/i2c/bitbang_i2c.h */ -typedef struct bitbang_i2c_interface bitbang_i2c_interface ; -#define TYPE_PPC4xx_I2C "ppc4xx-i2c"#define PPC4xx_I2C (obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
Re: [Qemu-devel] [PATCH 01/36] i2c: Move typedef of bitbang_i2c_interface to i2c.h
Quoted 14 lines · BALATON Zoltan
Quoted 6 lines · Michael Roth
From: BALATON Zoltan <[email protected]>
Clang 3.4 considers duplicate typedef in
ppc4xx_i2c.handbitbang_i2c.han error even if they are identical. Move it to a common place to allow building with this clang version.Quoted 6 lines
Reported-by Thomas Huth <[email protected]>Signed-off-by BALATON Zoltan <[email protected]>Acked-by David Gibson <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Thomas Huth <[email protected]>(cherry picked from commit 2b4c1125ac3db2734222ff43c25388a16aca4a99)
Quoted 2 lines
This was superseded by
d718b7475later so you may want to look at that instead but for stable branch I'm not sure what are your preferences.
You could also cherry-pick this commit here instead:
e6e90feedb706b1b92827a5977b37e1e8defb8ef
"configure: Add -Wno-typedef-redefinition to CFLAGS (for Clang)"
... this should fix this problem for good.
Thomas
PATCH 2/36 iotests: make 235 work on s390 (and others)
In reply to Michael RothFrom: Christian Borntraeger <[email protected]>
"-machine pc" will not work all architectures. Lets fall back to the default machine by not specifying it.
In addition we also need to specify -no-shutdown on s390 as qemu will exit otherwise.
--- tests/qemu-iotests/235 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/qemu-iotests/235 +3 -1
@@ -49,7 +49,9 @@ qemu_img_create('-f', iotests.imgfmt, '-o', 'preallocation=metadata', disk, str(size)) vm = QEMUMachine(iotests.qemu_prog) -vm.add_args('-machine', 'pc,accel=kvm') +vm.add_args('-machine', 'accel=kvm') +if iotests.qemu_default_machine == 's390-ccw-virtio': + vm.add_args('-no-shutdown') vm.add_args('-drive', 'id=src,file=' + disk) vm.launch()
Signature · 1 line
2.17.1
PATCH 3/36 Changes requirement for "vsubsbs" instruction
In reply to Michael RothFrom: "Paul A. Clarke" <[email protected]>
Changes requirement for "vsubsbs" instruction, which has been supported since ISA 2.03. (Please see section 5.9.1.2 of ISA 2.03)
--- target/ppc/translate/vmx-ops.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/translate/vmx-ops.inc.c +1 -1
@@ -143,7 +143,7 @@ GEN_VXFORM(vaddsws, 0, 14),GEN_VXFORM_DUAL (vsububs, bcdadd,0 ,24 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM_DUAL (vsubuhs, bcdsub,0 ,25 ,PPC_ALTIVEC ,PPC_NONE ),GEN_VXFORM (vsubuws,0 ,26 ), -GEN_VXFORM_DUAL (vsubsbs, bcdtrunc,0 ,28 ,PPC_NONE ,PPC2_ISA300 ), +GEN_VXFORM_DUAL (vsubsbs, bcdtrunc,0 ,28 ,PPC_ALTIVEC ,PPC2_ISA300 ),GEN_VXFORM (vsubshs,0 ,29 ),GEN_VXFORM_DUAL (vsubsws, xpnd04_2,0 ,30 ,PPC_ALTIVEC ,PPC_NONE ), GEN_VXFORM_207(vadduqm, 0, 4),
Signature · 1 line
2.17.1
PATCH 4/36 pcie: set link state inactive/active after hot unplug/plug
In reply to Michael RothFrom: Zheng Xiang <[email protected]>
When VM boots from the latest version of linux kernel, after hot-unpluging virtio-blk disks which are hotplugged into pcie-root-port, the VM's dmesg log shows:
[ 151.046242] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0001 from Slot Status [ 151.046365] pciehp 0000:00:05.0:pcie004: Slot(0-3): Attention button pressed [ 151.046369] pciehp 0000:00:05.0:pcie004: Slot(0-3): Powering off due to button press [ 151.046420] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 151.046425] pciehp 0000:00:05.0:pcie004: pciehp_green_led_blink: SLOTCTRL a8 write cmd 200 [ 151.046464] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 151.046468] pciehp 0000:00:05.0:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0 [ 156.163421] pciehp 0000:00:05.0:pcie004: pciehp_get_power_status: SLOTCTRL a8 value read 2f1 [ 156.163427] pciehp 0000:00:05.0:pcie004: pciehp_unconfigure_device: domain:bus:dev = 0000:06:00 [ 156.198736] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 156.198772] pciehp 0000:00:05.0:pcie004: pciehp_power_off_slot: SLOTCTRL a8 write cmd 400 [ 157.224124] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0018 from Slot Status [ 157.224194] pciehp 0000:00:05.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300 [ 157.224220] pciehp 0000:00:05.0:pcie004: pciehp_check_link_active: lnk_status = 2011 [ 157.224223] pciehp 0000:00:05.0:pcie004: Slot(0-3): Link Up [ 157.224233] pciehp 0000:00:05.0:pcie004: pciehp_get_power_status: SLOTCTRL a8 value read 7f1 [ 157.224281] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 157.224285] pciehp 0000:00:05.0:pcie004: pciehp_power_on_slot: SLOTCTRL a8 write cmd 0 [ 157.224300] pciehp 0000:00:05.0:pcie004: __pciehp_link_set: lnk_ctrl = 0 [ 157.224336] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 157.224339] pciehp 0000:00:05.0:pcie004: pciehp_green_led_blink: SLOTCTRL a8 write cmd 200 [ 159.739294] pci 0000:06:00.0 id reading try 50 times with interval 20 ms to get ffffffff [ 159.739315] pciehp 0000:00:05.0:pcie004: pciehp_check_link_status: lnk_status = 2011 [ 159.739318] pciehp 0000:00:05.0:pcie004: Failed to check link status [ 159.739371] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 159.739394] pciehp 0000:00:05.0:pcie004: pciehp_power_off_slot: SLOTCTRL a8 write cmd 400 [ 160.771426] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 160.771452] pciehp 0000:00:05.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300 [ 160.771495] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 160.771499] pciehp 0000:00:05.0:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd 40 [ 160.771535] pciehp 0000:00:05.0:pcie004: pending interrupts 0x0010 from Slot Status [ 160.771539] pciehp 0000:00:05.0:pcie004: pciehp_green_led_off: SLOTCTRL a8 write cmd 300
After analyzing the log information, it seems that qemu doesn't change the Link Status from active to inactive after hot-unplug. This results in the abnormal log after the linux kernel commit d331710ea78fea merged.
Furthermore, If I hotplug the same virtio-blk disk after hot-unplug, the virtio-blk would turn on and then back off.
So this patch set the Link Status inactive after hot-unplug and active after hot-plug.
--- hw/pci/pcie.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/pci/pcie.c +12 -0
@@ -345,6 +345,10 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,if (!dev->hotplugged) {pci_word_test_and_set_mask (exp_cap +PCI_EXP_SLTSTA ,PCI_EXP_SLTSTA_PDS ); +if (pci_dev->cap_present &QEMU_PCIE_LNKSTA_DLLLA ) { +pci_word_test_and_set_mask (exp_cap +PCI_EXP_LNKSTA , +PCI_EXP_LNKSTA_DLLLA ); + }return ; }
@@ -355,6 +359,10 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,if (pci_get_function_0 (pci_dev)) {pci_word_test_and_set_mask (exp_cap +PCI_EXP_SLTSTA ,PCI_EXP_SLTSTA_PDS ); +if (pci_dev->cap_present &QEMU_PCIE_LNKSTA_DLLLA ) { +pci_word_test_and_set_mask (exp_cap +PCI_EXP_LNKSTA , +PCI_EXP_LNKSTA_DLLLA ); + }pcie_cap_slot_event (PCI_DEVICE (hotplug_dev),PCI_EXP_HP_EV_PDC |PCI_EXP_HP_EV_ABP ); }
@@ -531,6 +539,10 @@ void pcie_cap_slot_write_config(PCIDevice *dev,pci_word_test_and_clear_mask (exp_cap +PCI_EXP_SLTSTA ,PCI_EXP_SLTSTA_PDS ); +if (dev->cap_present &QEMU_PCIE_LNKSTA_DLLLA ) { +pci_word_test_and_clear_mask (exp_cap +PCI_EXP_LNKSTA , +PCI_EXP_LNKSTA_DLLLA ); + }pci_word_test_and_set_mask (exp_cap +PCI_EXP_SLTSTA ,PCI_EXP_SLTSTA_PDC ); }
Signature · 1 line
2.17.1
PATCH 5/36 pc:piix4: Update smbus I/O space after a migration
In reply to Michael RothFrom: Corey Minyard <[email protected]>
Otherwise it won't be set up correctly and won't work after miigration.
--- hw/acpi/piix4.c | 1 + 1 file changed, 1 insertion(+)
hw/acpi/piix4.c +1 -0
@@ -173,6 +173,7 @@ static int vmstate_acpi_post_load(void *opaque, int version_id)PIIX4PMState *s = opaque;pm_io_space_update (s); +smbus_io_space_update (s);return 0 ; }
Signature · 1 line
2.17.1
PATCH 6/36 hw/s390x: Fix bad mask in time2tod()
In reply to Michael RothFrom: Thomas Huth <[email protected]>
Since "s390x/tcg: avoid overflows in time2tod/tod2time", the time2tod() function tries to deal with the 9 uppermost bits in the time value, but uses the wrong mask for this: 0xff80000000000000 should be used instead of 0xff10000000000000 here.
Message-Id: <[email protected]>
--- include/hw/s390x/tod.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/s390x/tod.h +1 -1
@@ -50,7 +50,7 @@ typedef struct S390TODClass {/* Converts ns to s390's clock format */ static inline uint64_t time2tod (uint64_t ns) { -return (ns <<9 ) /125 + (((ns &0xff10000000000000ull ) /125 ) <<9 ); +return (ns <<9 ) /125 + (((ns &0xff80000000000000ull ) /125 ) <<9 ); }/* Converts s390's clock format to ns */
Signature · 1 line
2.17.1
PATCH 7/36 linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0
In reply to Michael RothFrom: Peter Maydell <[email protected]>
Linux returns success if pwrite64() or pread64() are called with a zero length NULL buffer, but QEMU was returning -TARGET_EFAULT.
This is the same bug that we fixed in commit 58cfa6c2e6eb51b23cc9 for the write syscall, and long before that in 38d840e6790c29f59 for the read syscall.
Message-Id: <[email protected]>
--- linux-user/syscall.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
linux-user/syscall.c +18 -4
@@ -9677,8 +9677,15 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, arg4 = arg5; arg5 = arg6; } -if (!(p =lock_user (VERIFY_WRITE , arg2, arg3,0 ))) -return -TARGET_EFAULT ; +if (arg2 ==0 && arg3 ==0 ) { +/* Special-case NULL buffer and zero length, which should succeed */ + p =0 ; + }else { + p =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (!p) { +return -TARGET_EFAULT ; + } + } ret =get_errno (pread64 (arg1, p, arg3,target_offset64 (arg4, arg5)));unlock_user (p, arg2, ret);return ret;
@@ -9687,8 +9694,15 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, arg4 = arg5; arg5 = arg6; } -if (!(p =lock_user (VERIFY_READ , arg2, arg3,1 ))) -return -TARGET_EFAULT ; +if (arg2 ==0 && arg3 ==0 ) { +/* Special-case NULL buffer and zero length, which should succeed */ + p =0 ; + }else { + p =lock_user (VERIFY_READ , arg2, arg3,1 ); +if (!p) { +return -TARGET_EFAULT ; + } + } ret =get_errno (pwrite64 (arg1, p, arg3,target_offset64 (arg4, arg5)));unlock_user (p, arg2,0 );return ret;
Signature · 1 line
2.17.1
PATCH 8/36 s390x: Return specification exception for unimplemented diag 308 subcodes
In reply to Michael RothFrom: Janosch Frank <[email protected]>
The architecture specifies specification exceptions for all unavailable subcodes.
The presence of subcodes is indicated by checking some query subcode. For example 6 will indicate that 3-6 are available. So future systems might call new subcodes to check for new features. This should not trigger a hw error, instead we return the architectured specification exception.
Message-Id: <[email protected]>
--- target/s390x/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/diag.c +1 -1
@@ -130,7 +130,7 @@ out: }return ;default : -hw_error ("Unhandled diag308 subcode %" PRIx64, subcode); +s390_program_interrupt (env,PGM_SPECIFICATION ,ILEN_AUTO , ra);break ; } }
Signature · 1 line
2.17.1
PATCH 9/36 exec.c: Don't reallocate IOMMUNotifiers that are in use
In reply to Michael RothFrom: Peter Maydell <[email protected]>
The tcg_register_iommu_notifier() code has a GArray of TCGIOMMUNotifier structs which it has registered by passing memory_region_register_iommu_notifier() a pointer to the embedded IOMMUNotifier field. Unfortunately, if we need to enlarge the array via g_array_set_size() this can cause a realloc(), which invalidates the pointer that memory_region_register_iommu_notifier() put into the MemoryRegion's iommu_notify list. This can result in segfaults.
Switch the GArray to holding pointers to the TCGIOMMUNotifier structs, so that we can individually allocate and free them.
Message-id: [email protected]
--- exec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
exec.c +6 -4
@@ -664,7 +664,7 @@ static void tcg_register_iommu_notifier(CPUState *cpu,int i;for (i =0 ; i < cpu->iommu_notifiers->len; i++) { - notifier = &g_array_index (cpu->iommu_notifiers, TCGIOMMUNotifier, i); + notifier = g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i);if (notifier->mr == mr && notifier->iommu_idx == iommu_idx) {break ; }
@@ -672,7 +672,8 @@ static void tcg_register_iommu_notifier(CPUState *cpu,if (i == cpu->iommu_notifiers->len) {/* Not found, add a new entry at the end of the array */ cpu->iommu_notifiers =g_array_set_size (cpu->iommu_notifiers, i +1 ); - notifier = &g_array_index (cpu->iommu_notifiers, TCGIOMMUNotifier, i); + notifier =g_new0 (TCGIOMMUNotifier,1 ); + g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i) = notifier; notifier->mr = mr; notifier->iommu_idx = iommu_idx;
@@ -704,8 +705,9 @@ static void tcg_iommu_free_notifier_list(CPUState *cpu)TCGIOMMUNotifier *notifier;for (i =0 ; i < cpu->iommu_notifiers->len; i++) { - notifier = &g_array_index (cpu->iommu_notifiers, TCGIOMMUNotifier, i); + notifier = g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i);memory_region_unregister_iommu_notifier (notifier->mr, ¬ifier->n); +g_free (notifier); }g_array_free (cpu->iommu_notifiers, true); }
@@ -975,7 +977,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu); } - cpu->iommu_notifiers =g_array_new (false, true,sizeof (TCGIOMMUNotifier)); + cpu->iommu_notifiers =g_array_new (false, true,sizeof (TCGIOMMUNotifier *));#endif }
Signature · 1 line
2.17.1
PATCH 10/36 tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
In reply to Michael RothFrom: Stefan Berger <[email protected]>
Make sure that the new locality passed to tpm_tis_prep_abort() is valid.
Add a comment to aborting_locty that it may be any locality, including TPM_TIS_NO_LOCALITY.
--- hw/tpm/tpm_tis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/tpm/tpm_tis.c +3 -1
@@ -263,7 +263,9 @@ static void tpm_tis_prep_abort(TPMState *s, uint8_t locty, uint8_t newlocty) {uint8_t busy_locty; - s->aborting_locty = locty; +assert (TPM_TIS_IS_VALID_LOCTY (newlocty)); + + s->aborting_locty = locty;/* may also be TPM_TIS_NO_LOCALITY */ s->next_locty = newlocty;/* locality after successful abort */ /*
Signature · 1 line
2.17.1
PATCH 11/36 tpm: Make sure the locality received from backend is valid
In reply to Michael RothFrom: Stefan Berger <[email protected]>
Make sure that the locality passed from the backend to tpm_tis_request_completed() is valid.
--- hw/tpm/tpm_tis.c | 2 ++ 1 file changed, 2 insertions(+)
hw/tpm/tpm_tis.c +2 -0
@@ -295,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)uint8_t locty = s->cmd.locty;uint8_t l; +assert (TPM_TIS_IS_VALID_LOCTY (locty)); +if (s->cmd.selftest_done) {for (l =0 ; l <TPM_TIS_NUM_LOCALITIES ; l++) { s->loc[l].sts |=TPM_TIS_STS_SELFTEST_DONE ;
Signature · 1 line
2.17.1
PATCH 12/36 block: Fix invalidate_cache error path for parent activation
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
bdrv_co_invalidate_cache() clears the BDRV_O_INACTIVE flag before actually activating a node so that the correct permissions etc. are taken. In case of errors, the flag must be restored so that the next call to bdrv_co_invalidate_cache() retries activation.
Restoring the flag was missing in the error path for a failed parent->role->activate() call. The consequence is that this attempt to activate all images correctly fails because we still set errp, however on the next attempt BDRV_O_INACTIVE is already clear, so we return success without actually retrying the failed action.
An example where this is observable in practice is migration to a QEMU instance that has a raw format block node attached to a guest device with share-rw=off (the default) while another process holds BLK_PERM_WRITE for the same image. In this case, all activation steps before parent->role->activate() succeed because raw can tolerate other writers to the image. Only the parent callback (in particular blk_root_activate()) tries to implement the share-rw=on property and requests exclusive write permissions. This fails when the migration completes and correctly displays an error. However, a manual 'cont' will incorrectly resume the VM without calling blk_root_activate() again.
This case is described in more detail in the following bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1531888
Fix this by correctly restoring the BDRV_O_INACTIVE flag in the error path.
--- block.c | 1 + 1 file changed, 1 insertion(+)
block.c +1 -0
@@ -4553,6 +4553,7 @@ static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs,if (parent->role->activate) { parent->role->activate (parent, &local_err);if (local_err) { + bs->open_flags |=BDRV_O_INACTIVE ;error_propagate (errp, local_err);return ; }
Signature · 1 line
2.17.1
PATCH 13/36 hw/rdma: another clang compilation fix
In reply to Michael RothFrom: Marcel Apfelbaum <[email protected]>
Configuring QEMU with:
configure --target-list="x86_64-softmmu" --cc=clang --enable-pvrdma
Results in:
qemu/hw/rdma/rdma_rm_defs.h:108:3: error: redefinition of typedef 'RdmaDeviceResources' is a C11 feature [-Werror,-Wtypedef-redefinition]
} RdmaDeviceResources;
^ qemu/hw/rdma/rdma_backend_defs.h:24:36: note: previous definition is here typedef struct RdmaDeviceResources RdmaDeviceResources;
Fix by removing one of the 'typedef' definitions.
Message-Id: <[email protected]>
*drop context dep. on c2dd117b385
--- hw/rdma/rdma_rm_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/rdma/rdma_rm_defs.h +2 -2
@@ -85,7 +85,7 @@ typedef struct RdmaRmPort {enum ibv_port_state state; } RdmaRmPort; -typedef struct RdmaDeviceResources { +struct RdmaDeviceResources {RdmaRmPort ports[MAX_PORTS ];RdmaRmResTbl pd_tbl;RdmaRmResTbl mr_tbl;
@@ -94,6 +94,6 @@ typedef struct RdmaDeviceResources {RdmaRmResTbl cq_tbl;RdmaRmResTbl cqe_ctx_tbl; GHashTable *qp_hash; /* Keeps mapping between real and emulated */ -} RdmaDeviceResources; +};#endif
Signature · 1 line
2.17.1
PATCH 14/36 slirp: check sscanf result when emulating ident
In reply to Michael RothFrom: William Bowling <[email protected]>
When emulating ident in tcp_emu, if the strchr checks passed but the sscanf check failed, two uninitialized variables would be copied and sent in the reply, so move this code inside the if(sscanf()) clause.
Message-Id: <[email protected]>
--- slirp/tcp_subr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
slirp/tcp_subr.c +5 -5
@@ -657,12 +657,12 @@ tcp_emu(struct socket *so, struct mbuf *m)break ; } } + so_rcv->sb_cc =snprintf (so_rcv->sb_data, + so_rcv->sb_datalen, +"%d,%d\r\n" , n1, n2); + so_rcv->sb_rptr = so_rcv->sb_data; + so_rcv->sb_wptr = so_rcv->sb_data + so_rcv->sb_cc; } - so_rcv->sb_cc =snprintf (so_rcv->sb_data, - so_rcv->sb_datalen, -"%d,%d\r\n" , n1, n2); - so_rcv->sb_rptr = so_rcv->sb_data; - so_rcv->sb_wptr = so_rcv->sb_data + so_rcv->sb_cc; }m_free (m);return 0 ;
Signature · 1 line
2.17.1
PATCH 15/36 tpm_tis: fix loop that cancels any seizure by a lower locality
In reply to Michael RothFrom: Liam Merwick <[email protected]>
In tpm_tis_mmio_write() if the requesting locality is seizing access, any seizure by a lower locality is cancelled. However the loop doing the seizure had an off-by-one error and the locality immediately preceding the requesting locality was not being cleared. This is fixed by adjusting the test in the for loop to check the localities up to the requesting locality.
--- hw/tpm/tpm_tis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/tpm/tpm_tis.c +1 -1
@@ -620,7 +620,7 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr, }/* cancel any seize by a lower locality */ -for (l =0 ; l < locty -1 ; l++) { +for (l =0 ; l < locty; l++) { s->loc[l].access &= ~TPM_TIS_ACCESS_SEIZE ; }
Signature · 1 line
2.17.1
PATCH 16/36 vfio-ap: flag as compatible with balloon
In reply to Michael RothFrom: Cornelia Huck <[email protected]>
vfio-ap devices do not pin any pages in the host. Therefore, they are compatible with memory ballooning.
Flag them as compatible, so both vfio-ap and a balloon can be used simultaneously.
--- hw/vfio/ap.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/vfio/ap.c +8 -0
@@ -104,6 +104,14 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp) vapdev->vdev.name =g_strdup_printf ("%s" , mdevid); vapdev->vdev.dev = dev; +/* +* vfio-ap devices operate in a way compatible with +* memory ballooning, as no pages are pinned in the host. +* This needs to be set before vfio_get_device() for vfio common to +* handle the balloon inhibitor. +*/ + vapdev->vdev.balloon_allowed = true; + ret =vfio_get_device (vfio_group, mdevid, &vapdev->vdev, &local_err);if (ret) { goto out_get_dev_err;
Signature · 1 line
2.17.1
PATCH 17/36 i386: remove the new CPUID 'PCONFIG' from Icelake-Server CPU model
In reply to Michael RothFrom: Robert Hoo <[email protected]>
PCONFIG is not available to guests; it must be specifically enabled using the PCONFIG_ENABLE execution control. Disable it, because no one can ever use it.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
target/i386/cpu.c +1 -2
@@ -2613,8 +2613,7 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_7_0_ECX_AVX512VNNI |CPUID_7_0_ECX_AVX512BITALG | CPUID_7_0_ECX_AVX512_VPOPCNTDQ | CPUID_7_0_ECX_LA57, .features[FEAT_7_0_EDX ] = -CPUID_7_0_EDX_PCONFIG |CPUID_7_0_EDX_SPEC_CTRL | - CPUID_7_0_EDX_SPEC_CTRL_SSBD, + CPUID_7_0_EDX_SPEC_CTRL | CPUID_7_0_EDX_SPEC_CTRL_SSBD,/* Missing: XSAVES (not supported by some Linux versions, * including v4.1 to v4.12). * KVM doesn't yet expose any XSAVES state save component,
Signature · 1 line
2.17.1
PATCH 18/36 i386: remove the 'INTEL_PT' CPUID bit from named CPU models
In reply to Michael RothFrom: Paolo Bonzini <[email protected]>
Processor tracing is not yet implemented for KVM and it will be an opt in feature requiring a special module parameter. Disable it, because it is wrong to enable it by default and it is impossible that no one has ever used it.
*drop context dependency on ecb85fe48
--- target/i386/cpu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
target/i386/cpu.c +3 -5
@@ -2493,8 +2493,7 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_7_0_EBX_SMAP |CPUID_7_0_EBX_MPX |CPUID_7_0_EBX_CLWB |CPUID_7_0_EBX_AVX512F |CPUID_7_0_EBX_AVX512DQ |CPUID_7_0_EBX_AVX512BW |CPUID_7_0_EBX_AVX512CD | -CPUID_7_0_EBX_AVX512VL |CPUID_7_0_EBX_CLFLUSHOPT | - CPUID_7_0_EBX_INTEL_PT, + CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT, .features[FEAT_7_0_ECX ] =CPUID_7_0_ECX_PKU |CPUID_7_0_ECX_OSPKE | CPUID_7_0_ECX_AVX512VNNI,
@@ -2546,7 +2545,7 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_7_0_EBX_HLE |CPUID_7_0_EBX_AVX2 |CPUID_7_0_EBX_SMEP |CPUID_7_0_EBX_BMI2 |CPUID_7_0_EBX_ERMS |CPUID_7_0_EBX_INVPCID |CPUID_7_0_EBX_RTM |CPUID_7_0_EBX_RDSEED |CPUID_7_0_EBX_ADX | - CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_INTEL_PT, + CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_MPX, .features[FEAT_7_0_ECX ] =CPUID_7_0_ECX_VBMI |CPUID_7_0_ECX_UMIP |CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE | CPUID_7_0_ECX_VBMI2 | CPUID_7_0_ECX_GFNI |
@@ -2604,8 +2603,7 @@ static X86CPUDefinition builtin_x86_defs[] = {CPUID_7_0_EBX_SMAP |CPUID_7_0_EBX_MPX |CPUID_7_0_EBX_CLWB |CPUID_7_0_EBX_AVX512F |CPUID_7_0_EBX_AVX512DQ |CPUID_7_0_EBX_AVX512BW |CPUID_7_0_EBX_AVX512CD | -CPUID_7_0_EBX_AVX512VL |CPUID_7_0_EBX_CLFLUSHOPT | - CPUID_7_0_EBX_INTEL_PT, + CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT, .features[FEAT_7_0_ECX ] =CPUID_7_0_ECX_VBMI |CPUID_7_0_ECX_UMIP |CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE | CPUID_7_0_ECX_VBMI2 | CPUID_7_0_ECX_GFNI |
Signature · 1 line
2.17.1
PATCH 19/36 json: Fix % handling when not interpolating
In reply to Michael RothFrom: Christophe Fergeau <[email protected]>
Commit 8bca4613 added support for %% in json strings when interpolating, but in doing so broke handling of % when not interpolating.
When parse_string() is fed a string token containing '%', it skips the '%' regardless of ctxt->ap, i.e. even it's not interpolating. If the '%' is the string's last character, it fails an assertion. Else, it "merely" swallows the '%'.
Fix parse_string() to handle '%' specially only when interpolating.
To gauge the bug's impact, let's review non-interpolating users of this parser, i.e. code passing NULL context to json_message_parser_init():
* tests/check-qjson.c, tests/test-qobject-input-visitor.c, tests/test-visitor-serialization.c
Plenty of tests, but we still failed to cover the buggy case.
* monitor.c: QMP input
* qga/main.c: QGA input
* qobject_from_json():
- qobject-input-visitor.c: JSON command line option arguments of -display and -blockdev
Reproducer: -blockdev '{"%"}'
- block.c: JSON pseudo-filenames starting with "json:"
Reproducer: https://bugzilla.redhat.com/show_bug.cgi?id=1668244#c3
- block/rbd.c: JSON key pairs
Pseudo-filenames starting with "rbd:".
Command line, QMP and QGA input are trusted.
Filenames are trusted when they come from command line, QMP or HMP. They are untrusted when they come from from image file headers.
Example: QCOW2 backing file name. Note that this is *not* the security boundary between host and guest. It's the boundary between host and an image file from an untrusted source.
Neither failing an assertion nor skipping a character in a filename of your choice looks exploitable. Note that we don't support compiling with NDEBUG.
Message-Id: <[email protected]>
--- qobject/json-parser.c | 10 ++++++---- tests/check-qjson.c | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-)
qobject/json-parser.c +6 -4
@@ -208,11 +208,13 @@ static QString *parse_string(JSONParserContext *ctxt, JSONToken *token) }break ;case '%' : -if (ctxt->ap && ptr[1 ] !='%' ) { -parse_error (ctxt, token,"can't interpolate into string" ); - goto out; +if (ctxt->ap) { +if (ptr[1 ] !='%' ) { +parse_error (ctxt, token,"can't interpolate into string" ); + goto out; + } + ptr++; } - ptr++;/* fall through */ default : cp =mod_utf8_codepoint (ptr,6 , &end);
tests/check-qjson.c +5 -0
@@ -175,6 +175,11 @@ static void utf8_string(void)"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5" ,"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5" ,"\\u03BA\\u1F79\\u03C3\\u03BC\\u03B5" , + }, + /* '%' character when not interpolating */ + { +"100%" , + "100%", },/* 2 Boundary condition test cases */ /* 2.1 First possible sequence of a certain length */
Signature · 1 line
2.17.1
PATCH 20/36 qga-win: include glib when building VSS DLL
In reply to Michael RothCommit 3ebee3b191e defined assert() as g_assert(), but when we build the VSS DLL component of QGA (to handle fsfreeze) we do not include glib, which results in breakage when building with VSS support enabled.
Fix this by including glib (along with the -lintl and -lws2_32 dependencies it brings).
Since the VSS DLL is built statically, this introduces an additional dependency on static glib and supporting libs for the mingw environment (possibly why we didn't include glib originally), but VSS support already has very specific prerequisites so it shouldn't affect too many build environments.
Since the VSS DLL code does use qemu/osdep.h, this should also help avoid future breakages and possibly allow for some clean ups in current VSS code.
--- qga/vss-win32/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/Makefile.objs +1 -1
@@ -5,7 +5,7 @@ qga-vss-dll-obj-y += requester.o provider.o install.o obj-qga-vss-dll-obj-y = $(addprefix $(obj)/, $(qga-vss-dll-obj-y)) $(obj-qga-vss-dll-obj-y): QEMU_CXXFLAGS = $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls -fstack-protector-all -fstack-protector-strong, $(QEMU_CFLAGS)) -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor -$(obj)/qga-vss.dll: LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lole32 -loleaut32 -lshlwapi -luuid -static +$(obj)/qga-vss.dll: LDFLAGS = -shared -Wl,--add-stdcall-alias,--enable-stdcall-fixup -lglib-2.0 -lole32 -loleaut32 -lshlwapi -luuid -lintl -lws2_32 -static $(obj)/qga-vss.dll: $(obj-qga-vss-dll-obj-y) $(SRC_PATH)/$(obj)/qga-vss.def $(call quiet-command,$(CXX) -o $@ $(qga-vss-dll-obj-y) $(SRC_PATH)/qga/vss-win32/qga-vss.def $(CXXFLAGS) $(LDFLAGS),"LINK","$(TARGET_DIR)$@")
Signature · 1 line
2.17.1
PATCH 21/36 configure: improve usbfs check
In reply to Michael RothFrom: Thomas Petazzoni <[email protected]>
The current check to test if usbfs support should be compiled or not solely relies on the presence of <linux/usbdevice_fs.h>, without actually checking that all definition used by Qemu are provided by this header file.
With sufficiently old kernel headers, <linux/usbdevice_fs.h> may be present, but some of the definitions needed by Qemu may not be available.
This commit improves the check by building a small program that actually tests whether the necessary definitions are available.
In addition, it fixes a bug where have_usbfs was set to "yes" regardless of the result of the test.
Message-Id: <[email protected]>
--- configure | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
configure +17 -2
@@ -4203,10 +4203,25 @@ fi # check for usbfs have_usbfs=no if test "$linux_user" = "yes"; then - if check_include linux/usbdevice_fs.h; then + cat > $TMPC << EOF +#include <linux/usbdevice_fs.h> + +#ifndef USBDEVFS_GET_CAPABILITIES +#error "USBDEVFS_GET_CAPABILITIES undefined" +#endif + +#ifndef USBDEVFS_DISCONNECT_CLAIM +#error "USBDEVFS_DISCONNECT_CLAIM undefined" +#endif + +int main(void) +{ + return 0; +} +EOF + if compile_prog "" ""; then have_usbfs=yes fi - have_usbfs=yes fi # check for fallocate
Signature · 1 line
2.17.1
PATCH 22/36 mac_oldworld: use node name instead of alias name for hd device in FWPathProvider
In reply to Michael RothFrom: Mark Cave-Ayland <[email protected]>
When using -drive to configure the hd drive for the Old World machine, the node name "disk" should be used instead of the "hd" alias.
Message-Id: <[email protected]>
--- hw/ppc/mac_oldworld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/mac_oldworld.c +2 -2
@@ -404,11 +404,11 @@ static char *heathrow_fw_dev_path(FWPathProvider *p, BusState *bus,return g_strdup ("cdrom" ); } -return g_strdup ("hd" ); +return g_strdup ("disk" ); }if (!strcmp (object_get_typename (OBJECT (dev)),"ide-hd" )) { -return g_strdup ("hd" ); +return g_strdup ("disk" ); }if (!strcmp (object_get_typename (OBJECT (dev)),"ide-cd" )) {
Signature · 1 line
2.17.1
PATCH 23/36 mac_newworld: use node name instead of alias name for hd device in FWPathProvider
In reply to Michael RothFrom: Mark Cave-Ayland <[email protected]>
When using -drive to configure the hd drive for the New World machine, the node name "disk" should be used instead of the "hd" alias.
Message-Id: <[email protected]>
--- hw/ppc/mac_newworld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/mac_newworld.c +2 -2
@@ -553,11 +553,11 @@ static char *core99_fw_dev_path(FWPathProvider *p, BusState *bus,return g_strdup ("cdrom" ); } -return g_strdup ("hd" ); +return g_strdup ("disk" ); }if (!strcmp (object_get_typename (OBJECT (dev)),"ide-hd" )) { -return g_strdup ("hd" ); +return g_strdup ("disk" ); }if (!strcmp (object_get_typename (OBJECT (dev)),"ide-cd" )) {
Signature · 1 line
2.17.1
PATCH 24/36 qga: update docs with systemd suspend support info
In reply to Michael RothFrom: Daniel Henrique Barboza <[email protected]>
Commit 067927d62e ("qga: systemd hibernate/suspend/hybrid-sleep support") failed to update qapi-schema.json after adding systemd hibernate/suspend/hybrid-sleep capabilities to guest-suspend-* QGA commands.
--- qga/qapi-schema.json | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
qga/qapi-schema.json +14 -11
@@ -532,12 +532,12 @@ # # Suspend guest to disk. # -# This command tries to execute the scripts provided by the pm-utils package. -# If it's not available, the suspend operation will be performed by manually -# writing to a sysfs file. +# This command attempts to suspend the guest using three strategies, in this +# order: # -# For the best results it's strongly recommended to have the pm-utils -# package installed in the guest. +# - systemd hibernate +# - pm-utils (via pm-hibernate) +# - manual write into sysfs # # This command does NOT return a response on success. There is a high chance # the command succeeded if the VM exits with a zero exit status or, when
@@ -560,12 +560,12 @@ # # Suspend guest to ram. # -# This command tries to execute the scripts provided by the pm-utils package. -# If it's not available, the suspend operation will be performed by manually -# writing to a sysfs file. +# This command attempts to suspend the guest using three strategies, in this +# order: # -# For the best results it's strongly recommended to have the pm-utils -# package installed in the guest. +# - systemd suspend +# - pm-utils (via pm-suspend) +# - manual write into sysfs # # IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup' # command. Thus, it's *required* to query QEMU for the presence of the
@@ -592,7 +592,10 @@ # # Save guest state to disk and suspend to ram. # -# This command requires the pm-utils package to be installed in the guest. +# This command attempts to suspend the guest by executing, in this order: +# +# - systemd hybrid-sleep +# - pm-utils (via pm-suspend-hybrid) # # IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup' # command. Thus, it's *required* to query QEMU for the presence of the
Signature · 1 line
2.17.1
PATCH 25/36 usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
In reply to Michael RothFrom: Gerd Hoffmann <[email protected]>
Open files and directories with O_NOFOLLOW to avoid symlinks attacks. While being at it also add O_CLOEXEC.
usb-mtp only handles regular files and directories and ignores everything else, so users should not see a difference.
Because qemu ignores symlinks, carrying out a successful symlink attack requires swapping an existing file or directory below rootdir for a symlink and winning the race against the inotify notification to qemu.
Message-id: [email protected]
--- hw/usb/dev-mtp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
hw/usb/dev-mtp.c +9 -4
@@ -653,13 +653,18 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o) {struct dirent *entry;DIR *dir; +int fd;if (o->have_children) {return ; } o->have_children = true; - dir =opendir (o->path); + fd =open (o->path,O_DIRECTORY |O_CLOEXEC |O_NOFOLLOW ); +if (fd <0 ) { +return ; + } + dir =fdopendir (fd);if (!dir) {return ; }
@@ -1007,7 +1012,7 @@ static MTPData *usb_mtp_get_object(MTPState *s, MTPControl *c,trace_usb_mtp_op_get_object (s->dev.addr, o->handle, o->path); - d->fd =open (o->path,O_RDONLY ); + d->fd =open (o->path,O_RDONLY |O_CLOEXEC |O_NOFOLLOW );if (d->fd ==-1 ) {usb_mtp_data_free (d);return NULL ;
@@ -1031,7 +1036,7 @@ static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c, c->argv[1], c->argv[2]); d =usb_mtp_data_alloc (c); - d->fd =open (o->path,O_RDONLY ); + d->fd =open (o->path,O_RDONLY |O_CLOEXEC |O_NOFOLLOW );if (d->fd ==-1 ) {usb_mtp_data_free (d);return NULL ;
@@ -1658,7 +1663,7 @@ static void usb_mtp_write_data(MTPState *s) 0, 0, 0, 0); goto done; } - d->fd =open (path,O_CREAT |O_WRONLY , mask); + d->fd =open (path,O_CREAT |O_WRONLY |O_CLOEXEC |O_NOFOLLOW , mask);if (d->fd ==-1 ) {usb_mtp_queue_result (s,RES_STORE_FULL , d->trans,0 ,0 ,0 ,0 );
Signature · 1 line
2.17.1
PATCH 26/36 qemu-img: fix error reporting for -object
In reply to Michael RothFrom: Daniel P. Berrangé <[email protected]>
Error reporting for user_creatable_add_opts_foreach was changed so that it no longer called 'error_report_err' in:
commit 7e1e0c11127bde81cff260fc6859690435c509d6
Author: Markus Armbruster <[email protected]>
Date: Wed Oct 17 10:26:43 2018 +0200
qom: Clean up error reporting in user_creatable_add_opts_foreach()
Some callers were updated to pass in "&error_fatal" but all the ones in qemu-img were left passing NULL. As a result all errors went to /dev/null instead of being reported to the user.
--- qemu-img.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
qemu-img.c +13 -13
@@ -503,7 +503,7 @@ static int img_create(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) { goto fail; }
@@ -753,7 +753,7 @@ static int img_check(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -966,7 +966,7 @@ static int img_commit(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -1349,7 +1349,7 @@ static int img_compare(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) { ret =2 ; goto out4; }
@@ -2159,7 +2159,7 @@ static int img_convert(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) { goto fail_getopt; }
@@ -2713,7 +2713,7 @@ static int img_info(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -2932,7 +2932,7 @@ static int img_map(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -3081,7 +3081,7 @@ static int img_snapshot(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -3241,7 +3241,7 @@ static int img_rebase(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -3621,7 +3621,7 @@ static int img_resize(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) {return 1 ; }
@@ -3865,7 +3865,7 @@ static int img_amend(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) { ret =-1 ; goto out_no_progress; }
@@ -4509,7 +4509,7 @@ static int img_dd(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) { ret =-1 ; goto out; }
@@ -4786,7 +4786,7 @@ static int img_measure(int argc, char **argv)if (qemu_opts_foreach (&qemu_object_opts, user_creatable_add_opts_foreach, -NULL ,NULL )) { +NULL , &error_fatal)) { goto out; }
Signature · 1 line
2.17.1
PATCH 27/36 qcow2: Avoid COW during metadata preallocation
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
Limiting the allocation to INT_MAX bytes isn't particularly clever because it means that the final cluster will be a partial cluster which will be completed through a COW operation. This results in unnecessary data read and write requests which lead to an unwanted non-sparse filesystem block for metadata preallocation.
Align the maximum allocation size down to the cluster size to avoid this situation.
*modified to avoid functional dependency on 93e32b3e
--- block/qcow2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/qcow2.c +2 -1
@@ -2590,6 +2590,7 @@ static int qcow2_set_up_encryption(BlockDriverState *bs, static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset,uint64_t new_length) { +BDRVQcow2State *s = bs->opaque;uint64_t bytes;uint64_t host_offset =0 ;unsigned int cur_bytes;
@@ -2600,7 +2601,7 @@ static int coroutine_fn preallocate_co(BlockDriverState *bs, uint64_t offset, bytes = new_length - offset;while (bytes) { - cur_bytes =MIN (bytes,INT_MAX ); + cur_bytes =MIN (bytes,QEMU_ALIGN_DOWN (INT_MAX , s->cluster_size)); ret =qcow2_alloc_cluster_offset (bs, offset, &cur_bytes, &host_offset, &meta);if (ret <0 ) {
Signature · 1 line
2.17.1
PATCH 28/36 cutils: Fix size_to_str() on 32-bit platforms
In reply to Michael RothFrom: Eric Blake <[email protected]>
When extracting a human-readable size formatter, we changed 'uint64_t div' pre-patch to 'unsigned long div' post-patch. Which breaks on 32-bit platforms, resulting in 'inf' instead of intended values larger than 999GB.
--- util/cutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/cutils.c +1 -1
@@ -754,7 +754,7 @@ const char *qemu_ether_ntoa(const MACAddr *mac)char *size_to_str (uint64_t val) {static const char *suffixes[] = {"" ,"Ki" ,"Mi" ,"Gi" ,"Ti" ,"Pi" ,"Ei" }; -unsigned long div; +uint64_t div;int i;/*
Signature · 1 line
2.17.1
PATCH 29/36 block: Fix AioContext switch for bs->drv == NULL
In reply to Michael RothFrom: Kevin Wolf <[email protected]>
Even for block nodes with bs->drv == NULL, we can't just ignore a bdrv_set_aio_context() call. Leaving the node in its old context can mean that it's still in an iothread context in bdrv_close_all() during shutdown, resulting in an attempted unlock of the AioContext lock which we don't hold.
This is an example stack trace of a related crash:
#0 0x00007ffff59da57f in raise () at /lib64/libc.so.6
#1 0x00007ffff59c4895 in abort () at /lib64/libc.so.6
#2 0x0000555555b97b1e in error_exit (err=<optimized out>, msg=msg@entry=0x555555d386d0 <__func__.19059> "qemu_mutex_unlock_impl") at util/qemu-thread-posix.c:36
#3 0x0000555555b97f7f in qemu_mutex_unlock_impl (mutex=mutex@entry=0x5555568002f0, file=file@entry=0x555555d378df "util/async.c", line=line@entry=507) at util/qemu-thread-posix.c:97
#4 0x0000555555b92f55 in aio_context_release (ctx=ctx@entry=0x555556800290) at util/async.c:507
#5 0x0000555555b05cf8 in bdrv_prwv_co (child=child@entry=0x7fffc80012f0, offset=offset@entry=131072, qiov=qiov@entry=0x7fffffffd4f0, is_write=is_write@entry=true, flags=flags@entry=0)
at block/io.c:833
#6 0x0000555555b060a9 in bdrv_pwritev (qiov=0x7fffffffd4f0, offset=131072, child=0x7fffc80012f0) at block/io.c:990
#7 0x0000555555b060a9 in bdrv_pwrite (child=0x7fffc80012f0, offset=131072, buf=<optimized out>, bytes=<optimized out>) at block/io.c:990
#8 0x0000555555ae172b in qcow2_cache_entry_flush (bs=bs@entry=0x555556810680, c=c@entry=0x5555568cc740, i=i@entry=0) at block/qcow2-cache.c:51
#9 0x0000555555ae18dd in qcow2_cache_write (bs=bs@entry=0x555556810680, c=0x5555568cc740) at block/qcow2-cache.c:248
#10 0x0000555555ae15de in qcow2_cache_flush (bs=0x555556810680, c=<optimized out>) at block/qcow2-cache.c:259
#11 0x0000555555ae16b1 in qcow2_cache_flush_dependency (c=0x5555568a1700, c=0x5555568a1700, bs=0x555556810680) at block/qcow2-cache.c:194
#12 0x0000555555ae16b1 in qcow2_cache_entry_flush (bs=bs@entry=0x555556810680, c=c@entry=0x5555568a1700, i=i@entry=0) at block/qcow2-cache.c:194
#13 0x0000555555ae18dd in qcow2_cache_write (bs=bs@entry=0x555556810680, c=0x5555568a1700) at block/qcow2-cache.c:248
#14 0x0000555555ae15de in qcow2_cache_flush (bs=bs@entry=0x555556810680, c=<optimized out>) at block/qcow2-cache.c:259
#15 0x0000555555ad242c in qcow2_inactivate (bs=bs@entry=0x555556810680) at block/qcow2.c:2124
#16 0x0000555555ad2590 in qcow2_close (bs=0x555556810680) at block/qcow2.c:2153
#17 0x0000555555ab0c62 in bdrv_close (bs=0x555556810680) at block.c:3358
#18 0x0000555555ab0c62 in bdrv_delete (bs=0x555556810680) at block.c:3542
#19 0x0000555555ab0c62 in bdrv_unref (bs=0x555556810680) at block.c:4598
#20 0x0000555555af4d72 in blk_remove_bs (blk=blk@entry=0x5555568103d0) at block/block-backend.c:785
#21 0x0000555555af4dbb in blk_remove_all_bs () at block/block-backend.c:483
#22 0x0000555555aae02f in bdrv_close_all () at block.c:3412
#23 0x00005555557f9796 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4776The reproducer I used is a qcow2 image on gluster volume, where the virtual disk size (4 GB) is larger than the gluster volume size (64M), so we can easily trigger an ENOSPC. This backend is assigned to a virtio-blk device using an iothread, and then from the guest a 'dd if=/dev/zero of=/dev/vda bs=1G count=1' causes the VM to stop because of an I/O error. qemu_gluster_co_flush_to_disk() sets bs->drv = NULL on error, so when virtio-blk stops the dataplane, the block nodes stay in the iothread AioContext. A 'quit' monitor command issued from this paused state crashes the process.
*drop context dependency on e64f25f30b8
--- block.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
block.c +2 -10
@@ -5056,10 +5056,6 @@ void bdrv_detach_aio_context(BlockDriverState *bs)BdrvAioNotifier *baf, *baf_tmp;BdrvChild *child; -if (!bs->drv) { -return ; - } -assert (!bs->walking_aio_notifiers); bs->walking_aio_notifiers = true; QLIST_FOREACH_SAFE(baf, &bs->aio_notifiers, list, baf_tmp) {
@@ -5074,7 +5070,7 @@ void bdrv_detach_aio_context(BlockDriverState *bs)*/ bs->walking_aio_notifiers = false; -if (bs->drv->bdrv_detach_aio_context) { +if (bs->drv && bs->drv->bdrv_detach_aio_context) { bs->drv->bdrv_detach_aio_context (bs); } QLIST_FOREACH(child, &bs->children, next) {
@@ -5090,16 +5086,12 @@ void bdrv_attach_aio_context(BlockDriverState *bs,BdrvAioNotifier *ban, *ban_tmp;BdrvChild *child; -if (!bs->drv) { -return ; - } - bs->aio_context = new_context; QLIST_FOREACH(child, &bs->children, next) {bdrv_attach_aio_context (child->bs, new_context); } -if (bs->drv->bdrv_attach_aio_context) { +if (bs->drv && bs->drv->bdrv_attach_aio_context) { bs->drv->bdrv_attach_aio_context (bs, new_context); }
Signature · 1 line
2.17.1
PATCH 30/36 do not call vhost_net_cleanup() on running net from char user event
In reply to Michael RothFrom: Dan Streetman <[email protected]>
Currently, a user CHR_EVENT_CLOSED event will cause net_vhost_user_event() to call vhost_user_cleanup(), which calls vhost_net_cleanup() for all its queues. However, vhost_net_cleanup() must never be called like this for fully-initialized nets; when other code later calls vhost_net_stop() - such as from virtio_net_vhost_status() - it will try to access the already-cleaned-up fields and fail with assertion errors or segfaults.
The vhost_net_cleanup() will eventually be called from qemu_cleanup_net_client().
Message-Id: <[email protected]>
--- net/vhost-user.c | 1 - 1 file changed, 1 deletion(-)
net/vhost-user.c +0 -1
@@ -223,7 +223,6 @@ static void chr_closed_bh(void *opaque) s =DO_UPCAST (NetVhostUserState, nc, ncs[0 ]);qmp_set_link (name, false, &err); -vhost_user_stop (queues, ncs);qemu_chr_fe_set_handlers (&s->chr,NULL ,NULL , net_vhost_user_event,NULL , opaque,NULL , true);
Signature · 1 line
2.17.1
PATCH 31/36 s390x/cpumodel: ignore csske for expansion
In reply to Michael RothFrom: Christian Borntraeger <[email protected]>
csske will be removed in a future machine. Ignore it for expanding the cpu model. Otherwise qemu falls back to z9.
Message-Id: <[email protected]>
--- target/s390x/cpu_models.c | 2 ++ 1 file changed, 2 insertions(+)
target/s390x/cpu_models.c +2 -0
@@ -1297,6 +1297,8 @@ static void init_ignored_base_feat(void)S390_FEAT_KM_TDEA_192 ,S390_FEAT_KIMD_SHA_1 ,S390_FEAT_KLMD_SHA_1 , +/* CSSKE is deprecated on newer generations */ + S390_FEAT_CONDITIONAL_SSKE, };int i;
Signature · 1 line
2.17.1
PATCH 32/36 megasas: fix mapped frame size
In reply to Michael RothFrom: Peter Lieven <[email protected]>
the current value of 1024 bytes (16 * MFI_FRAME_SIZE) we map is not enough to hold the maximum number of scatter gather elements we advertise. We actually need a maximum of 2048 bytes. This is 128 max sg elements * 16 bytes (sizeof (union mfi_sgl)).
Message-Id: <[email protected]>
--- hw/scsi/megasas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/megasas.c +1 -1
@@ -477,7 +477,7 @@ static MegasasCmd *megasas_enqueue_frame(MegasasState *s, {PCIDevice *pcid =PCI_DEVICE (s);MegasasCmd *cmd =NULL ; -int frame_size =MFI_FRAME_SIZE *16 ; +int frame_size =MEGASAS_MAX_SGE *sizeof (union mfi_sgl );hwaddr frame_size_p = frame_size;unsigned long index;
Signature · 1 line
2.17.1
PATCH 33/36 iotests: Filter second BLOCK_JOB_ERROR from 229
In reply to Michael RothFrom: Max Reitz <[email protected]>
Without this filter, this test sometimes fails.
--- tests/qemu-iotests/229 | 6 +++++- tests/qemu-iotests/229.out | 1 - 2 files changed, 5 insertions(+), 2 deletions(-)
tests/qemu-iotests/229 +5 -1
@@ -82,11 +82,15 @@ echo echo '=== Force cancel job paused in error state ===' echo +# Filter out BLOCK_JOB_ERROR events because they may or may not occur. +# Cancelling the job means resuming it for a bit before it is actually +# aborted, and in that time it may or may not re-encounter the error. success_or_failure="y" _send_qemu_cmd $QEMU_HANDLE \ "{'execute': 'block-job-cancel', 'arguments': { 'device': 'testdisk', 'force': true}}" \ - "BLOCK_JOB_CANCELLED" "Assertion" + "BLOCK_JOB_CANCELLED" "Assertion" \ + | grep -v '"BLOCK_JOB_ERROR"' # success, all done echo "*** done"
tests/qemu-iotests/229.out +0 -1
@@ -17,7 +17,6 @@ wrote 2097152/2097152 bytes at offset 0 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "testdisk"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_ERROR", "data": {"device": "testdisk", "operation": "write", "action": "stop"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "aborting", "id": "testdisk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "testdisk", "len": 2097152, "offset": 1048576, "speed": 0, "type": "mirror"}} *** done
Signature · 1 line
2.17.1
PATCH 34/36 block/file-posix: Unaligned O_DIRECT block-status
In reply to Michael RothFrom: Max Reitz <[email protected]>
Currently, qemu crashes whenever someone queries the block status of an unaligned image tail of an O_DIRECT image:
$ echo > foo $ qemu-img map --image-opts driver=file,filename=foo,cache.direct=on Offset Length Mapped to File qemu-img: block/io.c:2093: bdrv_co_block_status: Assertion `*pnum && QEMU_IS_ALIGNED(*pnum, align) && align > offset - aligned_offset' failed.
This is because bdrv_co_block_status() checks that the result returned by the driver's implementation is aligned to the request_alignment, but file-posix can fail to do so, which is actually mentioned in a comment
there: "[...] possibly including a partial sector at EOF".
Fix this by rounding up those partial sectors.
There are two possible alternative fixes:
(1) We could refuse to open unaligned image files with O_DIRECT altogether. That sounds reasonable until you realize that qcow2 does necessarily not fill up its metadata clusters, and that nobody runs qemu-img create with O_DIRECT. Therefore, unpreallocated qcow2 files usually have an unaligned image tail.
(2) bdrv_co_block_status() could ignore unaligned tails. It actually throws away everything past the EOF already, so that sounds reasonable.
Unfortunately, the block layer knows file lengths only with a granularity of BDRV_SECTOR_SIZE, so bdrv_co_block_status() usually would have to guess whether its file length information is inexact or whether the driver is broken.
Fixing what raw_co_block_status() returns is the safest thing to do.
There seems to be no other block driver that sets request_alignment and does not make sure that it always returns aligned values.
--- block/file-posix.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
block/file-posix.c +16 -0
@@ -2461,6 +2461,8 @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs,off_t data =0 , hole =0 ;int ret; +assert (QEMU_IS_ALIGNED (offset | bytes, bs->bl.request_alignment)); + ret =fd_open (bs);if (ret <0 ) {return ret;
@@ -2486,6 +2488,20 @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs,/* On a data extent, compute bytes to the end of the extent, * possibly including a partial sector at EOF. */ *pnum =MIN (bytes, hole - offset); + +/* +* We are not allowed to return partial sectors, though, so +* round up if necessary. +*/ +if (!QEMU_IS_ALIGNED (*pnum, bs->bl.request_alignment)) { +int64_t file_length =raw_getlength (bs); +if (file_length >0 ) { +/* Ignore errors, this is just a safeguard */ +assert (hole == file_length); + } + *pnum =ROUND_UP (*pnum, bs->bl.request_alignment); + } + ret =BDRV_BLOCK_DATA ; }else {/* On a hole, compute bytes to the beginning of the next extent. */
Signature · 1 line
2.17.1
Quoted 8 lines · Michael Roth
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
Hello, Michael.
There is usually a breakdown by modified files within a cover letter.
Why is it not present here?
Sincerely,
Aleksandar
Quoted 16 lines
The release is planned for 2019-08-01:
https://wiki.qemu.org/Planning/3.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Thanks!
Quoting Aleksandar Markovic (2019-07-23 12:12:27)
Quoted 8 lines
Quoted 5 lines · Michael Roth
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
Quoted 8 lines
Quoted 3 lines
Hello, Michael.
There is usually a breakdown by modified files within a cover letter.
Why is it not present here?
Sorry meant to include it before hitting send. I've just sent it as a reply.
Quoted 23 lines
Sincerely,
AleksandarQuoted 16 lines
The release is planned for 2019-08-01:
https://wiki.qemu.org/Planning/3.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Thanks!
PATCH 35/36 iotests: Test unaligned raw images with O_DIRECT
In reply to Michael RothFrom: Max Reitz <[email protected]>
We already have 221 for accesses through the page cache, but it is better to create a new file for O_DIRECT instead of integrating those test cases into 221. This way, we can make use of _supported_cache_modes (and _default_cache_mode) so the test is automatically skipped on filesystems that do not support O_DIRECT.
As part of the split, add _supported_cache_modes to 221. With that, it no longer fails when run with -c none or -c directsync.
*remove context dependencies on iotests not in 3.1
--- tests/qemu-iotests/221 | 4 ++ tests/qemu-iotests/253 | 84 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/253.out | 14 +++++++ tests/qemu-iotests/group | 1 + 4 files changed, 103 insertions(+) create mode 100755 tests/qemu-iotests/253 create mode 100644 tests/qemu-iotests/253.out
tests/qemu-iotests/221 +4 -0
@@ -1,6 +1,7 @@ #!/bin/bash # # Test qemu-img vs. unaligned images +# (See also 253, which is the O_DIRECT version) # # Copyright (C) 2018 Red Hat, Inc. #
@@ -37,6 +38,9 @@ _supported_fmt raw _supported_proto file _supported_os Linux +_default_cache_mode writeback +_supported_cache_modes writeback writethrough unsafe + echo echo "=== Check mapping of unaligned raw image ===" echo
tests/qemu-iotests/253 new file +84 -0
84 lines not on this page · raw message
tests/qemu-iotests/253.out new file +14 -0
@@ -0,0 +1,14 @@ +QA output created by 253 + +=== Check mapping of unaligned raw image === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048575 +[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] +[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false, "offset": OFFSET}] +wrote 65535/65535 bytes at offset 983040 +63.999 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, +{ "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] +[{ "start": 0, "length": 983040, "depth": 0, "zero": true, "data": false, "offset": OFFSET}, +{ "start": 983040, "length": 65536, "depth": 0, "zero": false, "data": true, "offset": OFFSET}] +*** done
tests/qemu-iotests/group +1 -0
@@ -233,3 +233,4 @@ 233 auto quick 234 auto quick migration 235 auto quick +253 rw auto quick
Signature · 1 line
2.17.1
PATCH 36/36 vhost: fix vhost_log size overflow during migration
In reply to Michael RothFrom: Li Hangjing <[email protected]>
When a guest which doesn't support multiqueue is migrated with a multi queues vhost-user-blk deivce, a crash will occur like:
0 qemu_memfd_alloc (name=<value optimized out>, size=562949953421312, seals=<value optimized out>, fd=0x7f87171fe8b4, errp=0x7f87171fe8a8) at util/memfd.c:153 1 0x00007f883559d7cf in vhost_log_alloc (size=70368744177664, share=true) at hw/virtio/vhost.c:186
2 0x00007f88355a0758 in vhost_log_get (listener=0x7f8838bd7940, enable=1) at qemu-2-12/hw/virtio/vhost.c:211
3 vhost_dev_log_resize (listener=0x7f8838bd7940, enable=1) at hw/virtio/vhost.c:263
4 vhost_migration_log (listener=0x7f8838bd7940, enable=1) at hw/virtio/vhost.c:787
5 0x00007f88355463d6 in memory_global_dirty_log_start () at memory.c:2503
6 0x00007f8835550577 in ram_init_bitmaps (f=0x7f88384ce600, opaque=0x7f8836024098) at migration/ram.c:2173
7 ram_init_all (f=0x7f88384ce600, opaque=0x7f8836024098) at migration/ram.c:2192
8 ram_save_setup (f=0x7f88384ce600, opaque=0x7f8836024098) at migration/ram.c:2219
9 0x00007f88357a419d in qemu_savevm_state_setup (f=0x7f88384ce600) at migration/savevm.c:1002
10 0x00007f883579fc3e in migration_thread (opaque=0x7f8837530400) at migration/migration.c:2382
11 0x00007f8832447893 in start_thread () from /lib64/libpthread.so.0
12 0x00007f8832178bfd in clone () from /lib64/libc.so.6
This is because vhost_get_log_size() returns a overflowed vhost-log size. In this function, it uses the uninitialized variable vqs->used_phys and vqs->used_size to get the vhost-log size.
Message-Id: <[email protected]>
--- hw/virtio/vhost.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
hw/virtio/vhost.c +10 -0
@@ -131,6 +131,11 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, }for (i =0 ; i < dev->nvqs; ++i) {struct vhost_virtqueue *vq = dev->vqs + i; + +if (!vq->used_phys && !vq->used_size) { +continue ; + } +vhost_dev_sync_region (dev, section, start_addr, end_addr, vq->used_phys,range_get_last (vq->used_phys, vq->used_size)); }
@@ -168,6 +173,11 @@ static uint64_t vhost_get_log_size(struct vhost_dev *dev) }for (i =0 ; i < dev->nvqs; ++i) {struct vhost_virtqueue *vq = dev->vqs + i; + +if (!vq->used_phys && !vq->used_size) { +continue ; + } +uint64_t last = vq->used_phys + vq->used_size -1 ; log_size =MAX (log_size, last /VHOST_LOG_CHUNK +1 ); }
Signature · 1 line
2.17.1
Quoting Michael Roth (2019-07-23 12:00:28)
Quoted 10 lines
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
https://github.com/mdroth/qemu/commits/stable-3.1-staging
The release is planned for 2019-08-01:
Quoted 9 lines
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Thanks!
Forgot to include the usual patch list:
----------------------------------------------------------------
BALATON Zoltan (1):
i2c: Move typedef of bitbang_i2c_interface to i2c.h
Christian Borntraeger (2):
iotests: make 235 work on s390 (and others)
s390x/cpumodel: ignore csske for expansion
Christophe Fergeau (1):
json: Fix % handling when not interpolating
Corey Minyard (1):
pc:piix4: Update smbus I/O space after a migration
Cornelia Huck (1):
vfio-ap: flag as compatible with balloon
Dan Streetman (1):
do not call vhost_net_cleanup() on running net from char user event
Daniel Henrique Barboza (1):
qga: update docs with systemd suspend support info
Daniel P. Berrangé (1):
qemu-img: fix error reporting for -object
Eric Blake (1):
cutils: Fix size_to_str() on 32-bit platforms
Gerd Hoffmann (1):
usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
Janosch Frank (1):
s390x: Return specification exception for unimplemented diag 308 subcodes
Kevin Wolf (3):
block: Fix invalidate_cache error path for parent activation
qcow2: Avoid COW during metadata preallocation
block: Fix AioContext switch for bs->drv == NULL
Li Hangjing (1):
vhost: fix vhost_log size overflow during migration
Liam Merwick (1):
tpm_tis: fix loop that cancels any seizure by a lower locality
Marcel Apfelbaum (1):
hw/rdma: another clang compilation fix
Mark Cave-Ayland (2):
mac_oldworld: use node name instead of alias name for hd device in FWPathProvider
mac_newworld: use node name instead of alias name for hd device in FWPathProvider
Max Reitz (3):
iotests: Filter second BLOCK_JOB_ERROR from 229 block/file-posix: Unaligned O_DIRECT block-status
iotests: Test unaligned raw images with O_DIRECT
Michael Roth (1):
qga-win: include glib when building VSS DLL
Paolo Bonzini (1):
i386: remove the 'INTEL_PT' CPUID bit from named CPU models
Paul A. Clarke (1):
Changes requirement for "vsubsbs" instruction
Peter Lieven (1):
megasas: fix mapped frame size
Peter Maydell (2):
linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0 exec.c: Don't reallocate IOMMUNotifiers that are in use
Robert Hoo (1):
i386: remove the new CPUID 'PCONFIG' from Icelake-Server CPU model
Stefan Berger (2):
tpm: Make sure new locality passed to tpm_tis_prep_abort() is valid
tpm: Make sure the locality received from backend is valid
Thomas Huth (1):
hw/s390x: Fix bad mask in time2tod()
Thomas Petazzoni (1):
configure: improve usbfs check
William Bowling (1):
slirp: check sscanf result when emulating ident
Zheng Xiang (1):
pcie: set link state inactive/active after hot unplug/plug
block.c | 13 +++---------- block/file-posix.c | 16 ++++++++++++++++ block/qcow2.c | 3 ++- configure | 19 +++++++++++++++++-- exec.c | 10 ++++++---- hw/acpi/piix4.c | 1 + hw/i2c/bitbang_i2c.h | 2 -- hw/pci/pcie.c | 12 ++++++++++++ hw/ppc/mac_newworld.c | 4 ++-- hw/ppc/mac_oldworld.c | 4 ++-- hw/rdma/rdma_rm_defs.h | 4 ++-- hw/scsi/megasas.c | 2 +- hw/tpm/tpm_tis.c | 8 ++++++-- hw/usb/dev-mtp.c | 13 +++++++++---- hw/vfio/ap.c | 8 ++++++++ hw/virtio/vhost.c | 10 ++++++++++ include/hw/i2c/i2c.h | 2 ++ include/hw/i2c/ppc4xx_i2c.h | 3 --- include/hw/s390x/tod.h | 2 +- linux-user/syscall.c | 22 ++++++++++++++++++---- net/vhost-user.c | 1 - qemu-img.c | 26 +++++++++++++------------- qga/qapi-schema.json | 25 ++++++++++++++----------- qga/vss-win32/Makefile.objs | 2 +- qobject/json-parser.c | 10 ++++++---- slirp/tcp_subr.c | 10 +++++----- target/i386/cpu.c | 11 ++++------- target/ppc/translate/vmx-ops.inc.c | 2 +- target/s390x/cpu_models.c | 2 ++ target/s390x/diag.c | 2 +- tests/check-qjson.c | 5 +++++ tests/qemu-iotests/221 | 4 ++++ tests/qemu-iotests/229 | 6 +++++- tests/qemu-iotests/229.out | 1 - tests/qemu-iotests/235 | 4 +++- tests/qemu-iotests/253 | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/253.out | 14 ++++++++++++++ tests/qemu-iotests/group | 1 + util/cutils.c | 2 +- 39 files changed, 282 insertions(+), 88 deletions(-) create mode 100755 tests/qemu-iotests/253 create mode 100644 tests/qemu-iotests/253.out
Hi Michael,
Quoted 102 lines · Michael Roth
Quoting Michael Roth (2019-07-23 12:00:28)
Quoted 8 lines
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
https://github.com/mdroth/qemu/commits/stable-3.1-staging
The release is planned for 2019-08-01:
Quoted 9 lines
https://wiki.qemu.org/Planning/3.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
----------------------------------------------------------------
BALATON Zoltan (1):
i2c: Move typedef ofbitbang_i2c_interfacetoi2c.hChristian Borntraeger (2):
iotests: make 235 work on s390 (and others)
s390x/cpumodel: ignore csske for expansionChristophe Fergeau (1):
json: Fix % handling when not interpolatingCorey Minyard (1):
pc:piix4: Update smbus I/O space after a migrationCornelia Huck (1):
vfio-ap: flag as compatible with balloonDan Streetman (1):
do not callvhost_net_cleanup()on running net from char user eventDaniel Henrique Barboza (1):
qga: update docs with systemd suspend support infoDaniel P. Berrangé (1):
qemu-img: fix error reporting for -objectEric Blake (1):
cutils: Fixsize_to_str()on 32-bit platformsGerd Hoffmann (1):
usb-mtp: useO_NOFOLLOWandO_CLOEXEC.Janosch Frank (1):
s390x: Return specification exception for unimplemented diag 308 subcodesKevin Wolf (3):
block: Fixinvalidate_cacheerror path for parent activation
qcow2: Avoid COW during metadata preallocation
block: Fix AioContext switch forbs->drv== NULLLi Hangjing (1):
vhost: fixvhost_logsize overflow during migrationLiam Merwick (1):
tpm_tis: fix loop that cancels any seizure by a lower localityMarcel Apfelbaum (1):
hw/rdma: another clang compilation fixMark Cave-Ayland (2):
mac_oldworld: use node name instead of alias name for hd device in FWPathProvider
mac_newworld: use node name instead of alias name for hd device in FWPathProviderMax Reitz (3):
iotests: Filter secondBLOCK_JOB_ERRORfrom 229block/file-posix: UnalignedO_DIRECTblock-status
iotests: Test unaligned raw images withO_DIRECTMichael Roth (1):
qga-win: include glib when building VSS DLLPaolo Bonzini (1):
i386: remove the 'INTEL_PT' CPUID bit from named CPU modelsPaul A. Clarke (1):
Changes requirement for "vsubsbs" instructionPeter Lieven (1):
megasas: fix mapped frame sizePeter Maydell (2):
linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0exec.c: Don't reallocate IOMMUNotifiers that are in useRobert Hoo (1):
i386: remove the new CPUID 'PCONFIG' from Icelake-Server CPU modelStefan Berger (2):
tpm: Make sure new locality passed totpm_tis_prep_abort()is valid
tpm: Make sure the locality received from backend is validThomas Huth (1):
hw/s390x: Fix bad mask in time2tod()
Quoted 8 lines
Thomas Petazzoni (1):
configure: improve usbfs checkWilliam Bowling (1):
slirp: check sscanf result when emulating identZheng Xiang (1):
pcie: set link state inactive/active after hot unplug/plug
I have noted these too:
44c64e9095 target/m68k: Fix a tcg_temp leak526668c734 hw/ssi/xilinx_spips: Avoid out-of-bound access to lqspi_buf[] c0bccee9b4 hw/ssi/mss-spi: Avoid crash when reading empty RX FIFO a09ef50404 hw/display/xlnx_dp: Avoid crash when reading empty RX FIFO 3a283507c0 hw/block/pflash_cfi01: Add missing DeviceReset() handler
Quoted 107 lines · Michael Roth
Quoting Michael Roth (2019-07-23 12:00:28)
Quoted 10 lines
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
https://github.com/mdroth/qemu/commits/stable-3.1-staging
The release is planned for 2019-08-01:
Quoted 9 lines
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Thanks!
Forgot to include the usual patch list:
----------------------------------------------------------------
BALATON Zoltan (1):
i2c: Move typedef ofbitbang_i2c_interfacetoi2c.hChristian Borntraeger (2):
iotests: make 235 work on s390 (and others)
s390x/cpumodel: ignore csske for expansionChristophe Fergeau (1):
json: Fix % handling when not interpolatingCorey Minyard (1):
pc:piix4: Update smbus I/O space after a migrationCornelia Huck (1):
vfio-ap: flag as compatible with balloonDan Streetman (1):
do not callvhost_net_cleanup()on running net from char user eventDaniel Henrique Barboza (1):
qga: update docs with systemd suspend support infoDaniel P. Berrangé (1):
qemu-img: fix error reporting for -objectEric Blake (1):
cutils: Fixsize_to_str()on 32-bit platformsGerd Hoffmann (1):
usb-mtp: useO_NOFOLLOWandO_CLOEXEC.Janosch Frank (1):
s390x: Return specification exception for unimplemented diag 308 subcodesKevin Wolf (3):
block: Fixinvalidate_cacheerror path for parent activation
qcow2: Avoid COW during metadata preallocation
block: Fix AioContext switch forbs->drv== NULLLi Hangjing (1):
vhost: fixvhost_logsize overflow during migrationLiam Merwick (1):
tpm_tis: fix loop that cancels any seizure by a lower localityMarcel Apfelbaum (1):
hw/rdma: another clang compilation fixMark Cave-Ayland (2):
mac_oldworld: use node name instead of alias name for hd device in FWPathProvider
mac_newworld: use node name instead of alias name for hd device in FWPathProviderMax Reitz (3):
iotests: Filter secondBLOCK_JOB_ERRORfrom 229block/file-posix: UnalignedO_DIRECTblock-status
iotests: Test unaligned raw images withO_DIRECTMichael Roth (1):
qga-win: include glib when building VSS DLLPaolo Bonzini (1):
i386: remove the 'INTEL_PT' CPUID bit from named CPU modelsPaul A. Clarke (1):
Changes requirement for "vsubsbs" instructionPeter Lieven (1):
megasas: fix mapped frame sizePeter Maydell (2):
linux-user: make pwrite64/pread64(fd, NULL, 0, offset) return 0exec.c: Don't reallocate IOMMUNotifiers that are in useRobert Hoo (1):
i386: remove the new CPUID 'PCONFIG' from Icelake-Server CPU modelStefan Berger (2):
tpm: Make sure new locality passed totpm_tis_prep_abort()is valid
tpm: Make sure the locality received from backend is validThomas Huth (1):
hw/s390x: Fix bad mask in time2tod()
Quoted 8 lines
Thomas Petazzoni (1):
configure: improve usbfs checkWilliam Bowling (1):
slirp: check sscanf result when emulating identZheng Xiang (1):
pcie: set link state inactive/active after hot unplug/plug
I am having a spice build failure fixed by this commit:
commit be812c0ab7d5ab741d0d87387a75a0e8bb6461e7
Author: Lukáš Hrázký <[email protected]> Date: Fri Feb 15 16:09:19 2019 +0100
spice: set device address and device display ID in QXL interface
Calls the new SPICE QXL interface function spice_qxl_set_device_info to set the hardware address of the graphics device represented by the QXL interface (e.g. a PCI path) and the device display IDs (the IDs of the device's monitors that belong to this QXL interface).
Also stops using the deprecated spice_qxl_set_max_monitors, the new interface function replaces it.
Quoted 8 lines · Michael Roth
Hi everyone,
The following new patches are queued for QEMU stable v3.1.1:
https://github.com/mdroth/qemu/commits/stable-3.1-staging
The release is planned for 2019-08-01:
Quoted 9 lines
https://wiki.qemu.org/Planning/3.1
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Here's some extra patches we are carrying in Fedora 30
Thanks,
Cole
commit e014dbe74e0484188164c61ff6843f8a04a8cb9d
Author: Prasanna Kumar Kalever <[email protected]> Date: Tue Mar 5 16:46:33 2019 +0100
gluster: Handle changed glfs_ftruncate signature
commit 0e3b891fefacc0e49f3c8ffa3a753b69eb7214d2
Author: Niels de Vos <[email protected]> Date: Tue Mar 5 16:46:34 2019 +0100
gluster: the glfs_io_cbk callback function pointer adds pre/post
stat args
commit cce648613bc802be1b894227f7fd94d88476ea07
Author: Prasad J Pandit <[email protected]> Date: Wed Dec 12 23:28:17 2018 +0530
pvrdma: release device resources in case of an error
commit 2aa86456fb938a11f2b7bd57c8643c213218681c
Author: Prasad J Pandit <[email protected]> Date: Thu Dec 13 01:00:35 2018 +0530
pvrdma: add uar_read routine
commit e909ff93698851777faac3c45d03c1b73f311ea6
Author: Paolo Bonzini <[email protected]> Date: Fri Jan 11 17:27:31 2019 +0100
scsi-generic: avoid possible out-of-bounds access to r->buf
commit a7104eda7dab99d0cdbd3595c211864cba415905
Author: Prasad J Pandit <[email protected]> Date: Sun Jan 13 23:29:48 2019 +0530
slirp: check data length while emulating ident function
commit b05b267840515730dbf6753495d5b7bd8b04ad1c
Author: Gerd Hoffmann <[email protected]> Date: Tue Jan 8 11:23:01 2019 +0100
i2c-ddc: fix oob read
commit 9a1565a03b79d80b236bc7cc2dbce52a2ef3a1b8
Author: Daniel P. Berrangé <[email protected]> Date: Wed Mar 13 09:49:03 2019 +0000
seccomp: don't kill process for resource control syscalls
commit d52680fc932efb8a2f334cc6993e705ed1e31e99
Author: Prasad J Pandit <[email protected]> Date: Thu Apr 25 12:05:34 2019 +0530
qxl: check release info object
commit ad280559c68360c9f1cd7be063857853759e6a73
Author: Prasad J Pandit <[email protected]> Date: Fri Jan 4 15:19:10 2019 +0530
sun4u: add power_mem_read routine
commit da885fe1ee8b4589047484bd7fa05a4905b52b17
Author: Peter Maydell <[email protected]> Date: Fri Dec 14 13:30:52 2018 +0000
device_tree.c: Don't use load_image()
commit 065e6298a75164b4347682b63381dbe752c2b156
Author: Markus Armbruster <[email protected]> Date: Tue Apr 9 19:40:18 2019 +0200
device_tree: Fix integer overflowing in load_device_tree()
Quoted 12 lines · Michael Roth
Hi
everyone,The following new patches are queued for QEMU stable v3.1.1:
https://github.com/mdroth/qemu/commits/stable-3.1-staging
The release is planned for 2019-08-01:
Quoted 10 lines
Please respond here or CC [email protected] on any patches you think should be included in the release.
Note that this update falls outside the normal stable release support window (~1 development cycle), but is being released now since it was delayed from its intended release date.
Thanks!
Beyond what has already been suggested, here are some patches we've added to our v3.1.0 based QEMU releases:
commit 2c858ce5da8ae6689c75182b73bc455a291cad41
Author: Prasad J Pandit <[email protected]> Date: Thu Dec 13 01:00:36 2018 +0530
pvrdma: check number of pages when creating rings
commit f1e2e38ee0136b7710a2caa347049818afd57a1b
Author: Prasad J Pandit <[email protected]> Date: Thu Dec 13 01:00:39 2018 +0530
pvrdma: check return value from pvrdma_idx_ring_has_ routines
commit 509f57c98e7536905bb4902363d0cba66ce7e089
Author: Prasad J Pandit <[email protected]> Date: Thu Dec 13 01:00:37 2018 +0530
pvrdma: release ring object in case of an error
commit 4720cbeea1f42fd905fc69338fd42b191e58b412
Author: Kevin Wolf <[email protected]> Date: Mon Jan 7 13:02:48 2019 +0100
block: Fix hangs in synchronous APIs with iothreads
commit 6f5d8671225dc77190647f18a27a0d156d4ca97a
Author: Prasad J Pandit <[email protected]> Date: Tue Jul 23 16:17:52 2019 +0530
qemu-bridge-helper: restrict interface name to IFNAMSIZ
Thanks,
Bruce