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

Fix guest memory corruption caused by hvmloader #172

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions 1021-hvmloader-pci-do-not-allow-memory-relocate.patch
@@ -0,0 +1,30 @@
From bc81cb8b47b2c489fbc6068dff46898167cd760b Mon Sep 17 00:00:00 2001
Message-ID: <bc81cb8b47b2c489fbc6068dff46898167cd760b.1701370770.git.git@neowutran.ovh>
From: Neowutran <git@neowutran.ovh>
Date: Wed, 29 Nov 2023 20:35:02 +0100
Subject: [PATCH] fix hvmloader relocating memory and overwritting some part of guest memory

---
tools/firmware/hvmloader/pci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c
index 257a6feb..03b464da 100644
--- a/tools/firmware/hvmloader/pci.c
+++ b/tools/firmware/hvmloader/pci.c
@@ -118,7 +118,12 @@ void pci_setup(void)
* Since xend can only use qemu-traditional, I think this is the
* option that will have the least impact.
*/
- bool allow_memory_relocate = 1;
+ /*
+ * For QubesOS we default to 0. qemu-traditional is not used.
+ * Settings this parameter to 1 can result in memory corruption
+ * in the guest when passingthrough big pci device like GPU.
+ */
+ bool allow_memory_relocate = 0;

BUILD_BUG_ON((typeof(*pci_devfn_decode_type))PCI_COMMAND_IO !=
PCI_COMMAND_IO);
--
2.43.0
1 change: 1 addition & 0 deletions xen.spec.in
Expand Up @@ -187,6 +187,7 @@ Patch1016: 1016-gnttab-disable-grant-tables-v2-by-default.patch
Patch1017: 1017-Disable-TSX-by-default.patch
Patch1018: 1018-Fix-IGD-passthrough-with-linux-stubdomain.patch
Patch1019: 1019-Use-Linux-s-PAT.patch
Patch1021: 1021-hvmloader-pci-do-not-allow-memory-relocate.patch

# Reproducible builds
Patch1100: 1100-Define-build-dates-time-based-on-SOURCE_DATE_EPOCH.patch
Expand Down