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

[Xen-changelog] [xen stable-4.11] xen/arm: traps: Avoid using BUG_ON() in _show_registers()



commit cb86f3d039fcb6afa7b6ee3738050e08b1e5b71a
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Wed May 15 17:16:13 2019 +0100
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Mon Oct 28 14:30:49 2019 -0700

    xen/arm: traps: Avoid using BUG_ON() in _show_registers()
    
    At the moment, _show_registers() is using a BUG_ON() to assert only
    userspace will run 32-bit code in a 64-bit domain.
    
    Such extra precaution is not necessary and could be avoided by only
    checking the CPU mode to decide whether show_registers_64() or
    show_reigsters_32() should be called.
    
    This has also the nice advantage to avoid nested if in the code.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    (cherry picked from commit e04818b46d6b08ae22d4ef05fa4dc685bba42f57)
---
 xen/arch/arm/traps.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 5c18e918b0..ebc708f257 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -935,21 +935,11 @@ static void _show_registers(struct cpu_user_regs *regs,
 
     if ( guest_mode )
     {
-        if ( is_32bit_domain(v->domain) )
+        if ( psr_mode_is_32bit(regs->cpsr) )
             show_registers_32(regs, ctxt, guest_mode, v);
 #ifdef CONFIG_ARM_64
-        else if ( is_64bit_domain(v->domain) )
-        {
-            if ( psr_mode_is_32bit(regs->cpsr) )
-            {
-                BUG_ON(!usr_mode(regs));
-                show_registers_32(regs, ctxt, guest_mode, v);
-            }
-            else
-            {
-                show_registers_64(regs, ctxt, guest_mode, v);
-            }
-        }
+        else
+            show_registers_64(regs, ctxt, guest_mode, v);
 #endif
     }
     else
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.11

_______________________________________________
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®.