robust pthread_mutex_t in shared memory

Florian Weimer fweimer@redhat.com
Tue Apr 16 09:25:00 GMT 2019


* Michal Vaško:

> for anyone wondering, I manage to find out what the problem was. It is
> having a mutex on an address not dividable by 2, at least that is what
> it seems on my architecture x86. I have attached a simple program that
> always reproduces the problem for me. If I change HOLE_SIZE to a
> multiple of 2, it does not crash. Can anyone comment on this, please?
> Is this a bug?

It's a bug in your code.  The pthread data structures must be allocated
to match their alignment requirements.

Thanks,
Florian



More information about the Libc-help mailing list