Dear all,
        In kaffe 1.0.6, the lockObject/unlockObject in locks.c are just a wrapper
of lockMutex/unlockMutex. In kaffe, lockObject uses "&obj" as the "where"
parameter in lockMutex. As the lockMutex and unlockMutex support recursive
locks, and determine whether it is a last unlock by the following checking :
         if (lk->holder > where) {
                putHeavyLock(lkp, lk);
                ...
        }
        So the value of "where" is important for the unlocking.
        Now comes the problem.  When we call LockObject(obj) in one stack frame, the
slot address for obj(i.e. &obj)  is the address in the current frame. But
that slot address may be smaller than the stack address of object in a
subsequence call to unlockObj(obj); therefore that unlockObject(obj) will
mistakenly  assume that that is a recursive lock and won't unlock the
object.
        Any comments will be appreciated. Thanks.

        Regards,
        Zhu Wenzhang

Reply via email to