Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP5:Update
xen.32845
65b8f9ab-VT-d-else-vs-endif-misplacement.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 65b8f9ab-VT-d-else-vs-endif-misplacement.patch of Package xen.32845
# Commit cc6ba68edf6dcd18c3865e7d7c0f1ed822796426 # Date 2024-01-30 14:29:15 +0100 # Author Andrew Cooper <andrew.cooper3@citrix.com> # Committer Jan Beulich <jbeulich@suse.com> VT-d: Fix "else" vs "#endif" misplacement In domain_pgd_maddr() the "#endif" is misplaced with respect to "else". This generates incorrect logic when CONFIG_HVM is compiled out, as the "else" body is executed unconditionally. Rework the logic to use IS_ENABLED() instead of explicit #ifdef-ary, as it's clearer to follow. This in turn involves adjusting p2m_get_pagetable() to compile when CONFIG_HVM is disabled. This is XSA-450 / CVE-2023-46840. Fixes: 033ff90aa9c1 ("x86/P2M: p2m_{alloc,free}_ptp() and p2m_alloc_table() are HVM-only") Reported-by: Teddy Astie <teddy.astie@vates.tech> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -447,7 +447,14 @@ static inline bool_t p2m_is_altp2m(const return p2m->p2m_class == p2m_alternate; } -#define p2m_get_pagetable(p2m) ((p2m)->phys_table) +#ifdef CONFIG_HVM +static inline pagetable_t p2m_get_pagetable(const struct p2m_domain *p2m) +{ + return p2m->phys_table; +} +#else +pagetable_t p2m_get_pagetable(const struct p2m_domain *p2m); +#endif /* * Ensure any deferred p2m TLB flush has been completed on all VCPUs. --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -441,15 +441,13 @@ static paddr_t domain_pgd_maddr(struct d if ( pgd_maddr ) /* nothing */; -#ifdef CONFIG_HVM - else if ( iommu_use_hap_pt(d) ) + else if ( IS_ENABLED(CONFIG_HVM) && iommu_use_hap_pt(d) ) { pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d)); pgd_maddr = pagetable_get_paddr(pgt); } else -#endif { if ( !hd->arch.vtd.pgd_maddr ) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor