Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use graphics=vnc on TDVM #202

Open
pprincipeza opened this issue Aug 26, 2024 · 2 comments
Open

Can't use graphics=vnc on TDVM #202

pprincipeza opened this issue Aug 26, 2024 · 2 comments

Comments

@pprincipeza
Copy link

[Bug]
If a TDVM is created using libvirt, and it contains the VNC graphics setup as:

<graphics type="vnc"> <listen type="socket"></listen> </graphics>

The VM itself crashes, and the following entries are seen in the logs:

2024-07-11T09:19:19.469114Z qemu-system-x86_64: Failed to get registers: Input/output error 2024-07-11 09:19:19.853+0000: shutting down, reason=crashed

[Repro Steps]

  • Create a Noble (24.04) Host and Guest setup following the instructions in this Wiki.
  • Create a VM with graphics type as vnc. Example here [0].
  • Power the VM on.
  • Check for the qemu logs to find the aforementioned messages.

[Expectation]
VNC should not fail with TDX, unless there is a full statement outlining so.

[0] https://paste.ubuntu.com/p/7p3mVG8Qwy/

Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/PEK-1049.

This message was autogenerated

@fanchen2
Copy link
Contributor

fanchen2 commented Nov 14, 2024

a minor correction, the para for vnc is:
image

rpedgeco pushed a commit to intel/tdx that referenced this issue Jan 25, 2025
…or TDs

Add a method to ignore requests to update CPU dirty logging for TDs, as
basic TDX does not support the PML feature, and KVM TDX does not allocate
or flush PML buffers for TDs.

Do not invoke vmx_update_cpu_dirty_logging() for TDs, and doing so would
cause a NULL pointer access error.

This is to fix the issue first reported in [1], where QEMU attaches an
emulated VGA device to a TD, resulting in a "kernel NULL pointer
dereference" in the host.

In QEMU, vga_common_init() sets the vram memory region to have a
dirty_log_mask with bit DIRTY_MEMORY_VGA.

pci_cirrus_vga_realize
  vga_common_init
    vga_dirty_log_start
      memory_region_set_log
       mr->dirty_log_mask = 1 << DIRTY_MEMORY_VGA;

QEMU's KVM acceleration code checks if mr->dirty_log_mask is non-zero
before setting the KVM_MEM_LOG_DIRTY_PAGES flag for the corresponding
memslot (which has no flag KVM_MEM_GUEST_MEMFD) in KVM.

This causes KVM to detect that a memslot has the KVM_MEM_LOG_DIRTY_PAGES
flag and invoke kvm_mmu_update_cpu_dirty_logging() -->
vmx_update_cpu_dirty_logging() to turn on PML, leading to the NULL pointer
access error.

Reported-by: ANAND NARSHINHA PATIL <[email protected]>
Reported-by: Pedro Principeza <[email protected]>
Reported-by: Farrah Chen <[email protected]>
Closes: canonical/tdx#202
Link: canonical/tdx#202 [1]
Signed-off-by: Yan Zhao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@pprincipeza @fanchen2 and others