As specified in http://www.opengroup.org/onlinepubs/000095399/functions/pthread_mutexattr_getprioceiling.html, the prioceiling value shall be in range defined by SCHED_FIFO, but when calling it on a new mutexattr it is zero while the SCHED_FIFO range is 1..99. The same applies to phtread_mutex_getprioceiling(). This also causes the LTP testsuite to fail.
Created attachment 1100 [details] Proposed patch This patch makes the getprioceiling() functions check if the priority is high enough and bump it to the minimal allowable priority if not. It is rather ugly to do the sanitization at that point but the thing is that we default for 0 e.g. in the constant initializers so a pthread_mutexattr_init()-ish solution isn't really viable. Perhaps we could cache the range, though.
Adding Jakub Jelinek (the author of implementation of these calls) to Cc.
So, any thoughts about this?
Fix the test suite. glibc explicitly announces that priority protection is not supported.