summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-12-06MAINTAINERS: Update for this being the 4.16 stable branchIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-12-06xen/Makefile: Set version to reopen as 4.16 stable branchIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-30xen/Makefile: Set 4.16 versionIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-30CHANGELOG.md: Set 4.16 version and dateIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-30README: make heading say 4.16Ian Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-30SUPPORT.md: Define support lifetimeIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org> Acked-by: Jan Beulich <jbeulich@suse.com>
2021-11-30Config.mk: Bump tags to 4.16.0 finalIan Jackson
No actual change to the code since RC4. Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-30CHANGELOG: add missing entries for work during the 4.16 release cycleRoger Pau Monne
Document some of the relevant changes during the 4.16 release cycle. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-25Revert "x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf ↵Andrew Cooper
contents" OSSTest has identified a 3rd regression caused by this change. Migration between Xen 4.15 and 4.16 on the nocera pair of machines (AMD Opteron 4133) fails with: xc: error: Failed to set CPUID policy: leaf 00000000, subleaf ffffffff, msr ffffffff (22 = Invalid argument): Internal error xc: error: Restore failed (22 = Invalid argument): Internal error which is a safety check to prevent resuming the guest when the CPUID data has been truncated. The problem is caused by shrinking of the max policies, which is an ABI that needs handling compatibly between different versions of Xen. Furthermore, shrinking of the default policies also breaks things in some cases, because certain cpuid= settings in a VM config file which used to have an effect will now be silently discarded. This reverts commit 540d911c2813c3d8f4cdbb3f5672119e5e768a3d, as well as the partial fix attempt in 81da2b544cbb003a5447c9b14d275746ad22ab37 (which added one new case where cpuid= settings might not apply correctly) and restores the same behaviour as Xen 4.15. Fixes: 540d911c2813 ("x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents") Fixes: 81da2b544cbb ("x86/cpuid: prevent shrinking migrated policies max leaves") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Release_Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-23Turn off debug by defaultIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-23SUPPORT.md: Set Release Notes linkIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-23Config.mk: switch to named tags (for stable branch)Ian Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-22x86/P2M: deal with partial success of p2m_set_entry()Jan Beulich
M2P and PoD stats need to remain in sync with P2M; if an update succeeds only partially, respective adjustments need to be made. If updates get made before the call, they may also need undoing upon complete failure (i.e. including the single-page case). Log-dirty state would better also be kept in sync. Note that the change to set_typed_p2m_entry() may not be strictly necessary (due to the order restriction enforced near the top of the function), but is being kept here to be on the safe side. This is CVE-2021-28705 and CVE-2021-28709 / XSA-389. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2021-11-22x86/PoD: handle intermediate page orders in p2m_pod_cache_add()Jan Beulich
p2m_pod_decrease_reservation() may pass pages to the function which aren't 4k, 2M, or 1G. Handle all intermediate orders as well, to avoid hitting the BUG() at the switch() statement's "default" case. This is CVE-2021-28708 / part of XSA-388. Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges") Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2021-11-22x86/PoD: deal with misaligned GFNsJan Beulich
Users of XENMEM_decrease_reservation and XENMEM_populate_physmap aren't required to pass in order-aligned GFN values. (While I consider this bogus, I don't think we can fix this there, as that might break existing code, e.g Linux'es swiotlb, which - while affecting PV only - until recently had been enforcing only page alignment on the original allocation.) Only non-PoD code paths (guest_physmap_{add,remove}_page(), p2m_set_entry()) look to be dealing with this properly (in part by being implemented inefficiently, handling every 4k page separately). Introduce wrappers taking care of splitting the incoming request into aligned chunks, without putting much effort in trying to determine the largest possible chunk at every iteration. Also "handle" p2m_set_entry() failure for non-order-0 requests by crashing the domain in one more place. Alongside putting a log message there, also add one to the other similar path. Note regarding locking: This is left in the actual worker functions on the assumption that callers aren't guaranteed atomicity wrt acting on multiple pages at a time. For mis-aligned GFNs gfn_lock() wouldn't have locked the correct GFN range anyway, if it didn't simply resolve to p2m_lock(), and for well-behaved callers there continues to be only a single iteration, i.e. behavior is unchanged for them. (FTAOD pulling out just pod_lock() into p2m_pod_decrease_reservation() would result in a lock order violation.) This is CVE-2021-28704 and CVE-2021-28707 / part of XSA-388. Fixes: 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges") Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2021-11-22xen/page_alloc: Harden assign_pages()Julien Grall
domain_tot_pages() and d->max_pages are 32-bit values. While the order should always be quite small, it would still be possible to overflow if domain_tot_pages() is near to (2^32 - 1). As this code may be called by a guest via XENMEM_increase_reservation and XENMEM_populate_physmap, we want to make sure the guest is not going to be able to allocate more than it is allowed. Rework the allocation check to avoid any possible overflow. While the check domain_tot_pages() < d->max_pages should technically not be necessary, it is probably best to have it to catch any possible inconsistencies in the future. This is CVE-2021-28706 / part of XSA-385. Signed-off-by: Julien Grall <jgrall@amazon.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2021-11-19efi: fix alignment of function parameters in compat modeRoger Pau Monne
Currently the max_store_size, remain_store_size and max_size in compat_pf_efi_runtime_call are 4 byte aligned, which makes clang 13.0.0 complain with: In file included from compat.c:30: ./runtime.c:646:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 2 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch] &op->u.query_variable_info.max_store_size, ^ ./runtime.c:647:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 3 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch] &op->u.query_variable_info.remain_store_size, ^ ./runtime.c:648:13: error: passing 4-byte aligned argument to 8-byte aligned parameter 4 of 'QueryVariableInfo' may result in an unaligned pointer access [-Werror,-Walign-mismatch] &op->u.query_variable_info.max_size); ^ Fix this by bouncing the variables on the stack in order for them to be 8 byte aligned. Note this could be done in a more selective manner to only apply to compat code calls, but given the overhead of making an EFI call doing an extra copy of 3 variables doesn't seem to warrant the special casing. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Ian Jackson <iwj@xenproject.org> Signed-off-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- Changes since v3: - Remove hard tabs. Apply Jan's r-b as authorised in email. Changes since v2: - Adjust the commentary as per discussion. Changes since v1: - Copy back the results.
2021-11-19golang/xenlight: regen generated codeAnthony PERARD
Fixes: 7379f9e10a3b ("gnttab: allow setting max version per-domain") Fixes: 1e6706b0d123 ("xen/arm: Introduce gpaddr_bits field to struct xen_domctl_getdomaininfo") Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Nick Rosbrook <rosbrookn@ainfosec.com> Acked-by: Ian Jackson <iwj@xenproject.org> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-19VT-d: fix reduced page table levels support when sharing tablesJan Beulich
domain_pgd_maddr() contains logic to adjust the root address to be put in the context entry in case 4-level page tables aren't supported by an IOMMU. This logic may not be bypassed when sharing page tables. This is CVE-2021-28710 / XSA-390. Fixes: 25ccd093425c ("iommu: remove the share_p2m operation") Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-17tools/python: fix python libxc bindings to pass a max grant versionRoger Pau Monné
Such max version should be provided by the caller, otherwise the bindings will default to specifying a max version of 2, which is inline with the current defaults in the hypervisor. Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain') Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Jackson <iwj@xenproject.org> Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-17CHANGELOG: set Xen 4.15 release dateRoger Pau Monné
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-17test/tsx: set grant version for created domainsRoger Pau Monné
Set the grant table version for the created domains to use version 1, as such tests domains don't require the usage of the grant table at all. A TODO note is added to switch those dummy domains to not have a grant table at all when possible. Without setting the grant version the domains for the tests cannot be created. Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain') Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Reported-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-17tests/resource: set grant version for created domainsRoger Pau Monné
Set the grant table version for the created domains to use version 1, as that's the used by the test cases. Without setting the grant version the domains for the tests cannot be created. Fixes: 7379f9e10a ('gnttab: allow setting max version per-domain') Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-17domctl: introduce a macro to set the grant table max versionRoger Pau Monné
Such macro just clamps the passed version to fit in the designated bits of the domctl field. The main purpose is to make it clearer in the code when max grant version is being set in the grant_opts field. Existing users that where setting the version in the grant_opts field are switched to use the macro. No functional change intended. Requested-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> Acked-by: Julien Grall <jgrall@amazon.com> Reviewed-by: Ian Jackson <iwj@xenproject.org> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-16public/gnttab: relax v2 recommendationJan Beulich
With there being a way to disable v2 support, telling new guests to use v2 exclusively is not a good suggestion. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-12tests/resource: Extend to check that the grant frames are mapped correctlyJane Malalane
Previously, we checked that we could map 40 pages with nothing complaining. Now we're adding extra logic to check that those 40 frames are "correct". Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Jane Malalane <jane.malalane@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
2021-11-12x86/cpuid: prevent shrinking migrated policies max leavesRoger Pau Monne
CPUID policies from guest being migrated shouldn't have the maximum leaves shrink, as that would be a guest visible change. The hypervisor has no knowledge on whether a guest has been migrated or is build from scratch, and hence it must not blindly shrink the CPUID policy in recalculate_cpuid_policy. Remove the x86_cpuid_policy_shrink_max_leaves call from recalculate_cpuid_policy. Removing such call could be seen as a partial revert of 540d911c28. Instead let the toolstack shrink the policies for newly created guests, while keeping the previous values for guests that are migrated in. Note that guests migrated in without a CPUID policy won't get any kind of shrinking applied. Fixes: 540d911c28 ('x86/CPUID: shrink max_{,sub}leaf fields according to actual leaf contents') Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-12VT-d: per-domain IOMMU bitmap needs to have dynamic sizeJan Beulich
With no upper bound (anymore) on the number of IOMMUs, a fixed-size 64-bit map may be insufficient (systems with 40 IOMMUs have already been observed). Fixes: 27713fa2aa21 ("VT-d: improve save/restore of registers across S3") Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-11MAINTAINERS: add Bertrand to the ARM reviewersStefano Stabellini
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Acked-by: Bertrand Marquis <bertrand.marquis@arm.com> Acked-by: Julien Grall <jgrall@amazon.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-11xen/arm: allocate_bank_memory: don't create memory banks of size zeroStefano Stabellini
allocate_bank_memory can be called with a tot_size of zero, as an example see the implementation of allocate_memory which can call allocate_bank_memory with a tot_size of zero for the second memory bank. If tot_size == 0, don't create an empty memory bank, just return immediately without error. Otherwise a zero-size memory bank will be added to the domain device tree. Note that Linux is known to be able to cope with zero-size memory banks, and Xen more recently gained the ability to do so as well (5a37207df520 "xen/arm: bootfdt: Ignore empty memory bank"). However, there might be other non-Linux OSes that are not able to cope with empty memory banks as well as Linux (and now Xen). It would be more robust to avoid zero-size memory banks unless required. Moreover, the code to find empty address regions in make_hypervisor_node in Xen is not able to cope with empty memory banks today and would result in a Xen crash. This is only a latent bug because make_hypervisor_node is only called for Dom0 at present and allocate_memory is only called for DomU at the moment. (But if make_hypervisor_node was to be called for a DomU, then the Xen crash would become manifest.) Fixes: f2931b4233ec ("xen/arm: introduce allocate_memory") Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Reviewed-by: Julien Grall <jgrall@amazon.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-11xen/arm: don't assign domU static-mem to dom0 as reserved-memoryStefano Stabellini
DomUs static-mem ranges are added to the reserved_mem array for accounting, but they shouldn't be assigned to dom0 as the other regular reserved-memory ranges in device tree. In make_memory_nodes, fix the error by skipping banks with xen_domain set to true in the reserved-memory array. Also make sure to use the first valid (!xen_domain) start address for the memory node name. Fixes: 41c031ff437b ("xen/arm: introduce domain on Static Allocation") Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Reviewed-by: Penny Zheng <penny.zheng@arm.com> Reviewed-by: Julien Grall <jgrall@amazon.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-09tools/configure: make iPXE dependent on QEMU traditionalRoger Pau Monne
iPXE is only used by QEMU traditional, so make it off by default unless QEMU traditional is enabled. Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Fixes: bcf77ce510 ('configure: modify default of building rombios') Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Ian Jackson <iwj@xenproject.org>
2021-11-08gnttab: allow setting max version per-domainRoger Pau Monne
Introduce a new domain create field so that toolstack can specify the maximum grant table version usable by the domain. This is plumbed into xl and settable by the user as max_grant_version. Previously this was only settable on a per host basis using the gnttab command line option. Note the version is specified using 4 bits, which leaves room to specify up to grant table version 15. Given that we only have 2 grant table versions right now, and a new version is unlikely in the near future using 4 bits seems more than enough. xenstored stubdomains are limited to grant table v1 because the current MiniOS code used to build them only has support for grants v1. There are existing limits set for xenstored stubdomains at creation time that already match the defaults in MiniOS. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Acked-by: Christian Lindig <christian.lindig@citrix.com> Reviewed-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-08xen: Report grant table v1/v2 capabilities to the toolstackAndrew Cooper
In order to let the toolstack be able to set the gnttab version on a per-domain basis, it needs to know which ABIs Xen supports. Introduce XEN_SYSCTL_PHYSCAP_gnttab_v{1,2} for the purpose, and plumb in down into userspace. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Christian Lindig <christian.lindig@citrix.com> Reviewed-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Releae-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-05xen/efi: Fix Grub2 boot on arm64Luca Fancellu
The code introduced by commit a1743fc3a9fe9b68c265c45264dddf214fd9b882 ("arm/efi: Use dom0less configuration when using EFI boot") is introducing a problem to boot Xen using Grub2 on ARM machine using EDK2. Despite UEFI specification, EDK2+Grub2 is returning a NULL DeviceHandle inside the interface given by the LOADED_IMAGE_PROTOCOL service, this handle is used later by efi_bs->HandleProtocol(...) inside get_parent_handle(...) when requesting the SIMPLE_FILE_SYSTEM_PROTOCOL interface, causing Xen to stop the boot because of an EFI_INVALID_PARAMETER error. Before the commit above, the function was never called because the logic was skipping the call when there were multiboot modules in the DT because the filesystem was never used and the bootloader had put in place all the right modules in memory and the addresses in the DT. To fix the problem the old logic is put back in place. Because the handle was given to the efi_check_dt_boot(...), but the revert put the handle out of scope, the signature of the function is changed to use an EFI_LOADED_IMAGE handle and request the EFI_FILE_HANDLE only when needed (module found using xen,uefi-binary). Another problem is found when the UEFI stub tries to check if Dom0 image or DomUs are present. The logic doesn't work when the UEFI stub is not responsible to load any modules, so the efi_check_dt_boot(...) return value is modified to return the number of multiboot module found and not only the number of module loaded by the stub. Taking the occasion to update the comment in handle_module_node(...) to explain why we return success even if xen,uefi-binary is not found. Fixes: a1743fc3a9 ("arm/efi: Use dom0less configuration when using EFI boot") Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
2021-11-04tools: disable building qemu-trad per defaultJuergen Gross
Using qemu-traditional as device model is deprecated for some time now. So change the default for building it to "disable". This will affect ioemu-stubdom, too, as there is a direct dependency between the two. Today it is possible to use a PVH/HVM Linux-based stubdom as device model. Additionally using ioemu-stubdom isn't really helping for security, as it requires to run a very old and potentially buggy qemu version in a PV domain. This is adding probably more security problems than it is removing by using a stubdom. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Acked-by: Ian Jackson <iwj@xenproject.org> Release-acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-04configure: modify default of building rombiosJuergen Gross
The tools/configure script will default to build rombios if qemu traditional is enabled. If rombios is being built, ipxe will be built per default, too. This results in rombios and ipxe no longer being built by default when disabling qemu traditional. Fix that be rearranging the dependencies: - build ipxe by default - build rombios by default if either ipxe or qemu traditional are being built This modification prepares not building qemu traditional by default without affecting build of rombios and ipxe. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Ian Jackson <iwj@xenproject.org> Release-acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-04tools/helpers: fix broken xenstore stubdom initJuergen Gross
Commit 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()") broke starting the xenstore stubdom. This is due to a rather special way the xenstore stubdom domain config is being initialized: in order to support both, PV and PVH stubdom, init-xenstore-domain is using xc_dom_parse_image() to find the correct domain type. Unfortunately above commit requires xc_dom_boot_xen_init() to have been called before using xc_dom_parse_image(). This requires the domid, which is known only after xc_domain_create(), which requires the domain type. In order to break this circular dependency, call xc_dom_boot_xen_init() with an arbitrary domid first, and then set dom->guest_domid later. Fixes: 1787cc167906f3f ("libs/guest: Move the guest ABI check earlier into xc_dom_parse_image()") Signed-off-by: Juergen Gross <jgross@suse.com> Release-acked-by: Ian Jackson <iwj@xenproject.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2021-11-04x86/APIC: avoid iommu_supports_x2apic() on error pathJan Beulich
The value it returns may change from true to false in case iommu_enable_x2apic() fails and, as a side effect, clears iommu_intremap (as can happen at least on AMD). Latch the return value from the first invocation to replace the second one. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-04x86/IOMMU: mark IOMMU / intremap not in use when ACPI tables are missingJan Beulich
x2apic_bsp_setup() gets called ahead of iommu_setup(), and since x2APIC mode (physical vs clustered) depends on iommu_intremap, that variable needs to be set to off as soon as we know we can't / won't enable interrupt remapping, i.e. in particular when parsing of the respective ACPI tables failed. Move the turning off of iommu_intremap from AMD specific code into acpi_iommu_init(), accompanying it by clearing of iommu_enable. Take the opportunity and also fully skip ACPI table parsing logic on VT-d when both "iommu=off" and "iommu=no-intremap" are in effect anyway, like was already the case for AMD. The tag below only references the commit uncovering a pre-existing anomaly. Fixes: d8bd82327b0f ("AMD/IOMMU: obtain IVHD type to use earlier") Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-04x86/xstate: reset cached register values on resumeMarek Marczykowski-Górecki
set_xcr0() and set_msr_xss() use cached value to avoid setting the register to the same value over and over. But suspend/resume implicitly reset the registers and since percpu areas are not deallocated on suspend anymore, the cache gets stale. Reset the cache on resume, to ensure the next write will really hit the hardware. Choose value 0, as it will never be a legitimate write to those registers - and so, will force write (and cache update). Note the cache is used io get_xcr0() and get_msr_xss() too, but: - set_xcr0() is called few lines below in xstate_init(), so it will update the cache with appropriate value - get_msr_xss() is not used anywhere - and thus not before any set_msr_xss() that will fill the cache Fixes: aca2a985a55a "xen: don't free percpu areas during suspend" Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-03x86/traps: Fix typo in do_entry_CP()Andrew Cooper
The call to debugger_trap_entry() should pass the correct vector. The break-for-gdbsx logic is in practice unreachable because PV guests can't generate #CP, but it will interfere with anyone inserting custom debugging into debugger_trap_entry(). Fixes: 5ad05b9c2490 ("x86/traps: Implement #CP handler and extend #PF for shadow stacks") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-03xen/arm: fix SBDF calculation for vPCI MMIO handlersOleksandr Andrushchenko
While in vPCI MMIO trap handlers for the guest PCI host bridge it is not enough for SBDF translation to simply call VPCI_ECAM_BDF(info->gpa) as the base address may not be aligned in the way that the translation always work. If not adjusted with respect to the base address it may not be able to properly convert SBDF. Fix this by adjusting the gpa with respect to the host bridge base address in a way as it is done for x86. Please note, that this change is not strictly required given the current value of GUEST_VPCI_ECAM_BASE which has bits 0 to 27 clear, but could cause issues if such value is changed, or when handlers for dom0 ECAM regions are added as those will be mapped over existing hardware regions that could use non-aligned base addresses. Fixes: d59168dc05a5 ("xen/arm: Enable the existing x86 virtual PCI support for ARM") Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-03Revert "tools: disable building qemu-trad per default"Ian Jackson
Unfortunately this breaks the gitlab CI. See mails on-list. This reverts commit ce309942c791628ff42082d1b74bfaeaa5267ae0.
2021-11-03x86/shstk: Fix use of shadow stacks with XPTI activeAndrew Cooper
The call to setup_cpu_root_pgt(0) in smp_prepare_cpus() is too early. It clones the BSP's stack while the .data mapping is still in use, causing all mappings to be fully read read/write (and with no guard pages either). This ultimately causes #DF when trying to enter the dom0 kernel for the first time. Defer setting up BSPs XPTI pagetable until reinit_bsp_stack() after we've set up proper shadow stack permissions. Fixes: 60016604739b ("x86/shstk: Rework the stack layout to support shadow stacks") Fixes: b60ab42db2f0 ("x86/shstk: Activate Supervisor Shadow Stacks") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-03tools: disable building qemu-trad per defaultJuergen Gross
Using qemu-traditional as device model is deprecated for some time now. So change the default for building it to "disable". This will affect ioemu-stubdom, too, as there is a direct dependency between the two. Today it is possible to use a PVH/HVM Linux-based stubdom as device model. Additionally using ioemu-stubdom isn't really helping for security, as it requires to run a very old and potentially buggy qemu version in a PV domain. This is adding probably more security problems than it is removing by using a stubdom. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Acked-by: Ian Jackson <iwj@xenproject.org> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-03update system time immediately when VCPUOP_register_vcpu_infoDongli Zhang
The guest may access the pv vcpu_time_info immediately after VCPUOP_register_vcpu_info. This is to borrow the idea of VCPUOP_register_vcpu_time_memory_area, where the force_update_vcpu_system_time() is called immediately when the new memory area is registered. Otherwise, we may observe clock drift at the VM side if the VM accesses the clocksource immediately after VCPUOP_register_vcpu_info(). Reference: https://lists.xenproject.org/archives/html/xen-devel/2021-10/msg00571.html Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-03x86: de-duplicate MONITOR/MWAIT CPUID-related definitionsJan Beulich
As of 724b55f48a6c ("x86: introduce MWAIT-based, ACPI-less CPU idle driver") they (also) live in asm/mwait.h; no idea how I missed the duplicates back at the time. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Release-Acked-by: Ian Jackson <iwj@xenproject.org>
2021-11-01README, xen/Makefile: Change version to 4.16-rcIan Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>
2021-11-01Config.mk: pin QEMU_UPSTREAM_REVISION (prep for Xen 4.16 RC1)Ian Jackson
Signed-off-by: Ian Jackson <iwj@xenproject.org>