All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] x86/p2m-pt: fix (latent) page table mapping leak on do_recalc() error paths
@ 2019-11-25 13:49 Jan Beulich
  2019-11-25 14:39 ` George Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2019-11-25 13:49 UTC (permalink / raw)
  To: xen-devel
  Cc: George Dunlap, Andrew Cooper, Juergen Gross, Wei Liu,
	Roger Pau Monné

There are two mappings active in the middle of do_recalc(), and hence
commit 0d0f4d78e5d1 ("p2m: change write_p2m_entry to return an error
code") should have added (or otherwise invoked) unmapping code just
like it did in p2m_next_level(), despite us not expecting any errors
here. Arrange for the existing unmap invocation to take effect in all
cases.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/mm/p2m-pt.c
+++ b/xen/arch/x86/mm/p2m-pt.c
@@ -391,21 +391,22 @@ static int do_recalc(struct p2m_domain *
                     if ( err )
                     {
                         ASSERT_UNREACHABLE();
-                        goto out;
+                        break;
                     }
                 }
                 remainder -= 1UL << ((level - 1) * PAGETABLE_ORDER);
             }
             smp_wmb();
-            clear_recalc(l1, e);
-            err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
-            if ( err )
+            if ( !err )
             {
-                ASSERT_UNREACHABLE();
-                goto out;
+                clear_recalc(l1, e);
+                err = p2m->write_p2m_entry(p2m, gfn, pent, e, level + 1);
+                ASSERT(!err);
             }
         }
         unmap_domain_page((void *)((unsigned long)pent & PAGE_MASK));
+        if ( unlikely(err) )
+            goto out;
     }
 
     pent = p2m_find_entry(table, &gfn_remainder, gfn,

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH] x86/p2m-pt: fix (latent) page table mapping leak on do_recalc() error paths
  2019-11-25 13:49 [Xen-devel] [PATCH] x86/p2m-pt: fix (latent) page table mapping leak on do_recalc() error paths Jan Beulich
@ 2019-11-25 14:39 ` George Dunlap
  2019-11-26 10:08   ` Jürgen Groß
  0 siblings, 1 reply; 3+ messages in thread
From: George Dunlap @ 2019-11-25 14:39 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: George Dunlap, Andrew Cooper, Juergen Gross, Wei Liu,
	Roger Pau Monné

On 11/25/19 1:49 PM, Jan Beulich wrote:
> There are two mappings active in the middle of do_recalc(), and hence
> commit 0d0f4d78e5d1 ("p2m: change write_p2m_entry to return an error
> code") should have added (or otherwise invoked) unmapping code just
> like it did in p2m_next_level(), despite us not expecting any errors
> here. Arrange for the existing unmap invocation to take effect in all
> cases.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH] x86/p2m-pt: fix (latent) page table mapping leak on do_recalc() error paths
  2019-11-25 14:39 ` George Dunlap
@ 2019-11-26 10:08   ` Jürgen Groß
  0 siblings, 0 replies; 3+ messages in thread
From: Jürgen Groß @ 2019-11-26 10:08 UTC (permalink / raw)
  To: George Dunlap, Jan Beulich, xen-devel
  Cc: George Dunlap, Andrew Cooper, Wei Liu, Roger Pau Monné

On 25.11.19 15:39, George Dunlap wrote:
> On 11/25/19 1:49 PM, Jan Beulich wrote:
>> There are two mappings active in the middle of do_recalc(), and hence
>> commit 0d0f4d78e5d1 ("p2m: change write_p2m_entry to return an error
>> code") should have added (or otherwise invoked) unmapping code just
>> like it did in p2m_next_level(), despite us not expecting any errors
>> here. Arrange for the existing unmap invocation to take effect in all
>> cases.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
> 

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-26 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 13:49 [Xen-devel] [PATCH] x86/p2m-pt: fix (latent) page table mapping leak on do_recalc() error paths Jan Beulich
2019-11-25 14:39 ` George Dunlap
2019-11-26 10:08   ` Jürgen Groß

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.