Created attachment 8686 [details]
The kernel limits the length of the robust mutex list to 2048 entries. This constant does not seem to be exported to user space.
glibc needs to keep track of the number of locked robust mutexes and fail locking additional ones once ROBUST_LIST_LIMIT is exceeded. Otherwise, some locks will not be marked as EOWNERDEAD if the process exits while holding more than ROBUST_LIST_LIMIT locks.
The attached test case fails if invoked with an argument of 2049.
I found this while looking for a cause for bug 19004, but I think this is a completely different bug.
It is not possible to check for the limit at pthread_mutex_init time because the mutex could have been created in another process, and the limit is really a lock count limit.
I requested a clarification of the POSIX specification: http://austingroupbugs.net/view.php?id=988
It seems that POSIX already permits returning an EAGAIN error in this case.