multicore-locks/litl

pthread_create interposition not registering with glibc 2.36

Opened this issue · 2 comments

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:

  • Enable DEBUG_PTHREAD prints in src/utils.h
  • Compile LiTL
  • Use LiTL on any code with a pthread_create.
    The pthread_create debug line will never be printed as it is not called.

Do you have any idea why this would happen?

Thank you.

kelark commented

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'`

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)