multicore-locks / litl

LiTL: Library for Transparent Lock Interposition
MIT License
75 stars 21 forks source link

pthread_create interposition not registering with glibc 2.36 #11

Open vlaforet opened 1 year ago

vlaforet commented 1 year ago

Hi,

I am trying to re-use your library to transparently interpose a lock algorithm I am working on.

However, I have an issue with the interposition of pthread_create. With glibc 2.32 this function is interposed and everything works as intented. With glibc 2.36 the interposed function of pthread_create is never called. This breaks everything as the per-thread contexts are not initialized and then each thread uses the same context. The other pthread functions (like pthread_mutex_init for example) are interposed properly.

According to other developers I have been talking to about this issue, glibc 2.34 changed the way pthread is handled (before it was an external shared library, now it is included in libc). This might be related.

Glibc 2.36 is shipped with newer Linux distributions (like Debian 12). Reproduction steps on a system with glibc 2.36:

Do you have any idea why this would happen?

Thank you.

kelark commented 1 year ago

i tried your codes,and when i made it ,there was an error: /tmp/ccbGN1Ax.s:6: Error: multiple versions [pthread_create@GLIBC_2.34'|pthread_create@@GLIBC_2.2.5'] for symbol__pthread_create'`

vlaforet commented 1 year ago

Yes you are right. I had tried it with glibs 2.32 and 2.37 and it worked in both. However I now see that some other versions do not work the same way. What glibc version are you on? (ldd --version)