Ensuring that the class is initialized may cause fixup to be called
again, and when we return to the first fixup call, the fixup list will
be invalid. The solution is to not access the list anymore after we've
ensured that the class has been initialized.

This was introduced in:

Author: Vegard Nossum <[email protected]>
Date:   Tue Jul 7 15:36:28 2009 +0200

    vm: fix deadlock (error in invokestatic handling)

Signed-off-by: Vegard Nossum <[email protected]>
---
 arch/x86/emit-code.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index ffa491d..00b79c6 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -450,11 +450,16 @@ int fixup_static_at(unsigned long addr)
                        + this->insn->mach_offset;
 
                if ((unsigned long) site_addr == addr) {
-                       int ret = vm_class_ensure_init(this->vmf->class);
+                       struct vm_class *vmc = this->vmf->class;
+
+                       /* Note: After this call, we can no longer access
+                        * "this" because it may have been deleted already
+                        * (from insite the class initializer of "vmc". */
+                       int ret = vm_class_ensure_init(vmc);
                        if (ret)
                                return ret;
 
-                       fixup_static(this->vmf->class);
+                       fixup_static(vmc);
                        return 0;
                }
        }
-- 
1.6.0.4


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to