Bug 2086262

Summary: [Win11][tpm]vfio_listener_region_del received unaligned region
Product: Red Hat Enterprise Linux 9 Reporter: Yanghang Liu <yanghliu>
Component: qemu-kvmAssignee: Eric Auger <eric.auger>
qemu-kvm sub component: Devices QA Contact: Yanghang Liu <yanghliu>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: alex.williamson, chayang, coli, eric.auger, jinzhao, juzhang, virt-maint, yanghliu
Version: 9.1   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: qemu-kvm-7.0.0-6.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:54:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yanghang Liu 2022-05-15 07:46:32 UTC
Description of problem:
When hotunplug the PF from the win11 domain (with tpm device), the qemu-kvm will throw " vfio_listener_region del received unaligned region"



Version-Release number of selected component (if applicable):
5.14.0-87.el9.x86_64
qemu-kvm-7.0.0-3.el9.x86_64



How reproducible:
100%

Steps to Reproduce:
1. start a win11 domain with a QL41112 PF and tpm device

# virt-install --machine=q35 --noreboot --name=win11 --memory=4096 --vcpus=4 --graphics type=vnc,port=5911,listen=0.0.0.0 --import --noautoconsole  --network bridge=switch,model=virtio,mac=52:54:00:01:11:11 --disk path=/home/images/win11.qcow2,bus=virtio,cache=none,format=qcow2,io=threads,size=20  --boot=uefi --boot nvram.template=/usr/share/edk2/ovmf/OVMF_VARS.fd --tpm model=tpm-crb,backend.type=emulator --hostdev 0000:3b:00.0 

2. check the QL41112 PF info in the Win11 vm
The PF works properly

3. hot-unplug the PF from the win11 domain
virsh detach-device win11 /tmp/device/0000:3b:00.0.xml
Device detached successfully

4. check the qemu-kvm info

2022-05-15T07:44:06.263771Z qemu-kvm: vfio_listener_region_del received unaligned region


Actual results:
qemu-kvm: vfio_listener_region_del received unaligned region

Expected results:
The qemu-kvm will not throw any suspicious information

Additional info:

a similar bug : Bug 2037612 - [Win11][tpm][QL41112 PF] vfio_listener_region_add received unaligned region

Comment 1 Alex Williamson 2022-05-17 20:11:38 UTC
Eric, looks like we missed that vfio_listener_region_del() also needs to check vfio_known_safe_misalignment() now.

Comment 2 Eric Auger 2022-05-24 11:55:38 UTC
"[PATCH] vfio/common: remove spurious warning on vfio_listener_region_del" sent upstream

Comment 4 Yanan Fu 2022-06-13 09:55:00 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 5 Yanghang Liu 2022-06-14 05:51:52 UTC
> Steps to Reproduce:
> 1. start a win11 domain with a QL41112 PF and tpm device
> 
> # virt-install --machine=q35 --noreboot --name=win11 --memory=4096 --vcpus=4
> --graphics type=vnc,port=5911,listen=0.0.0.0 --import --noautoconsole 
> --network bridge=switch,model=virtio,mac=52:54:00:01:11:11 --disk
> path=/home/images/win11.qcow2,bus=virtio,cache=none,format=qcow2,io=threads,
> size=20  --boot=uefi --boot nvram.template=/usr/share/edk2/ovmf/OVMF_VARS.fd
> --tpm model=tpm-crb,backend.type=emulator --hostdev 0000:3b:00.0 
> 
> 2. check the QL41112 PF info in the Win11 vm
> The PF works properly
> 
> 3. hot-unplug the PF from the win11 domain
> virsh detach-device win11 /tmp/device/0000:3b:00.0.xml
> Device detached successfully
> 
> 4. check the qemu-kvm info
> 
> 2022-05-15T07:44:06.263771Z qemu-kvm: vfio_listener_region_del received unaligned region

This bug can still be reproduced in qemu-kvm-7.0.0-5.el9.x86_64

Comment 6 Yanghang Liu 2022-06-14 07:17:42 UTC
Verification:


Test env:
kernel-5.14.0-108.el9 
qemu-kvm-7.0.0-6.el9


Test result: PASS


Test step:
> 1. start a win11 domain with a QL41112 PF and tpm device
> 
> # virt-install --machine=q35 --noreboot --name=win11 --memory=4096 --vcpus=4
> --graphics type=vnc,port=5911,listen=0.0.0.0 --import --noautoconsole 
> --network bridge=switch,model=virtio,mac=52:54:00:01:11:11 --disk
> path=/home/images/win11.qcow2,bus=virtio,cache=none,format=qcow2,io=threads,
> size=20  --boot=uefi --boot nvram.template=/usr/share/edk2/ovmf/OVMF_VARS.fd
> --tpm model=tpm-crb,backend.type=emulator --hostdev 0000:3b:00.0 

The win11 domain with a QL41112 PF and tpm device can be started successfully

> 2. check the QL41112 PF info in the Win11 vm

The PF works properly
 
> 3. hot-unplug the PF from the win11 domain
> virsh detach-device win11 /tmp/device/0000:3b:00.0.xml
> Device detached successfully

{"execute":"device_del","arguments":{"id":"hostdev0"},"id":"libvirt-407"}
{"timestamp": {"seconds": 1655190578, "microseconds": 237219}, "event": "DEVICE_DELETED", "data": {"device": "hostdev0", "path": "/machine/peripheral/hostdev0"}}

> 4. check the qemu-kvm info

The qemu-kvm does not throw any suspicious information like "qemu-kvm: vfio_listener_region_del received unaligned region"

Comment 9 Yanghang Liu 2022-06-15 05:26:13 UTC
Move the bug status to VERIFIED based on Comment 5 and Comment 6

Comment 11 errata-xmlrpc 2022-11-15 09:54:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: qemu-kvm security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7967