Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pthread_create interposition not registering with glibc 2.36 #11

Open
vlaforet opened this issue Jun 28, 2023 · 2 comments
Open

pthread_create interposition not registering with glibc 2.36 #11

vlaforet opened this issue Jun 28, 2023 · 2 comments

Comments

@vlaforet
Copy link

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.

@vlaforet vlaforet changed the title pthread_create interposition pthread_create interposition not registering with glibc 2.36 Jun 28, 2023
@kelark
Copy link

kelark commented Jul 22, 2023

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
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants