Skip to contentSkip to conversation

xen/x86: use 64 bit mask when masking away mfn bits

PATCH In review Juergen Gross 3 participants 3 messages Mar 24, 2017 – Mar 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/x86: use 64 bit mask when masking away mfn bits

When using _PAGE_PSE_PAT as base for a negated bit mask make sure it is propagated to 64 bits when applied to a 64 bit value.

There seems to be only one place where this is a problem, so fix this by casting _PAGE_PSE_PAT to 64 bits there.

Not doing so will probably lead to problems on hosts with more than 16 TB of memory.

---
This patch should be considered for backporting.

---
 xen/arch/x86/mm/p2m-pt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/mm/p2m-pt.c +1 -1
index 07e2ccd..268b232 100644
@@ -450,7 +450,7 @@ static int do_recalc(struct p2m_domain *p2m, unsigned long gfn)
                      mfn |= _PAGE_PSE_PAT >> PAGE_SHIFT;
                 }
                 else
-                     mfn &= ~(_PAGE_PSE_PAT >> PAGE_SHIFT);
+                     mfn &= ~((unsigned long)_PAGE_PSE_PAT >> PAGE_SHIFT);
                 flags |= _PAGE_PSE;
             }
             e = l1e_from_pfn(mfn, flags);
Signature · 7 lines
2.10.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 24.03.17 at 09:50, <[email protected]> wrote:

When using _PAGE_PSE_PAT as base for a negated bit mask make sure it is propagated to 64 bits when applied to a 64 bit value.

There seems to be only one place where this is a problem, so fix this by casting _PAGE_PSE_PAT to 64 bits there.

Not doing so will probably lead to problems on hosts with more than 16 TB of memory.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/1
#2 lore raw
In reply to Juergen Gross
Quoted 10 lines · Juergen Gross

When using _PAGE_PSE_PAT as base for a negated bit mask make sure it is propagated to 64 bits when applied to a 64 bit value.

There seems to be only one place where this is a problem, so fix this by casting _PAGE_PSE_PAT to 64 bits there.

Not doing so will probably lead to problems on hosts with more than 16 TB of memory.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel