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]

[PATCH] Fix elision in nested trylock.


Attached is a patch that fixes a race condition in how Andi's current
patches use elision in trylock.  The elision code path in trylock aborts
if it is executed in a transaction, but the non-elision code path does
no such thing.  Thus, we need to avoid that a thread acquires a lock by
using elision and then executes a nested trylock that doesn't use
elision (the nested trylock would violate the POSIX requirements in this
case).  To do that, we recheck our elision decision in the transaction,
which ensures that the nested trylock will also execute the elision
path.  Another option to solve that would be to abort any transaction in
the non-elision code path too, but that might affect non-glibc-elision
transactions that use locks even more.

This patch might not apply cleanly to Andi's branches, but the comment
in it should clarify what's going on.  (And please keep the details of
the comment if you pick it up -- or expand the comments; everyone else
looking at the code in the future will appreciate it.)

Torvald

Attachment: patch4
Description: Text document


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