Marcos-David Dione wrote:
Marcos-David Dione/NCE/AMADEUS wrote on 24/11/2014 11:10:42:
Seen like that I'm not sure if there's a defined behaviour
for that. I'll ask in the glibc and/or kernel MLs and I'll come back with the answer.
and here's the answer:
On 11/24/2014 03:34 PM, Marcos Dione wrote:
We found a situation where a robust mutex cannot be recovered
from a stale lock and we're wondering if it's simply an undefined situation or a bug in the kernel. Attached you will find the sample code, which is loosely based on a glibc's test case.The gist of it
is as
follows:
- we open a file.
- we mmap it and use that mem to store a robust mutex.
- we lock the mutex.
- we munmap the file.
- we close the file.
Undefined behaviour.
This results in undefined behaviour since the allocated storage for the mutex object has been lost. You need to keep that storage around for the robust algorithms to work with. Without any data you can't do anything.
Full answer:
Fyi, this would not have been a bug in Solaris:
https://docs.oracle.com/cd/E19253-01/816-5168/pthread-mutexattr-setrobust-np...