This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #14477] Fix exception table of pthread_cond_wait oni386


On 09/28/2012 05:24 AM, Siddhesh Poyarekar wrote:
Hi,

I had earlier thought that this bug may be a slightly different
manifestation of the problem in bz #14417, but it is not.

pthread_cond_wait on i386 uses a slightly different code path for
priority inherited mutexes, by using the FUTEX_WAIT_REQUEUE_PI futex
operation instead of the usual FUTEX_WAIT.  When moving into the
syscall, it increments %ebx by 4 to have it point to the futex for the
syscall and then decrements it after returning from the syscall.

The exception table for the function compensates for this by marking
this part of the code and setting up the cleanup handler jump to
__condvar_w_cleanup2 instead of __condvar_w_cleanup, where the former
first decrements %ebx and then proceeds to cleanup.  A similar entry
was missing for the PI case, which resulted in the deadlock described
in BZ #14477.  Attached patch adds this entry for pthread_cond_wait and
pthread_cond_timedwait for i386.  The patch also has a test case to
verify this fix.

I have tested this patch on a 32-bit build and it does not cause any
regressions in the testsuite.  I have also verified that this test case
passes and that the test case fails without this patch.

OK to commit?
Yes, this looks good to me.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]