[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/arm: mm: Check start is always before end in {destroy, modify}_xen_mappings



commit 7e80a539e2805cb63c432caf7d0acafdfa1802d5
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Wed Apr 3 11:14:10 2019 +0100
Commit:     Julien Grall <julien.grall@xxxxxxx>
CommitDate: Thu Jun 6 18:44:33 2019 +0100

    xen/arm: mm: Check start is always before end in {destroy, 
modify}_xen_mappings
    
    The two helpers {destroy, modify}_xen_mappings don't check that the
    start is always before the end. This should never happen but if it
    happens, it will result to unexpected behavior.
    
    Catch such issues earlier on by adding an ASSERT in destroy_xen_mappings
    and modify_xen_mappings.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Andrii Anisov <andrii_anisov@xxxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/mm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 2ad12da5d1..6a549e9283 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1039,11 +1039,13 @@ int populate_pt_range(unsigned long virt, unsigned long 
nr_mfns)
 
 int destroy_xen_mappings(unsigned long v, unsigned long e)
 {
+    ASSERT(v <= e);
     return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 
0);
 }
 
 int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags)
 {
+    ASSERT(s <= e);
     return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT,
                               flags);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.