[RFC] elf: Implement filtering of symbols historically defined in libpthread

Florian Weimer fweimer@redhat.com
Tue May 4 12:04:43 GMT 2021


* H. J. Lu:

> Since we want to detect the binaries which were linked against glibc
> older than 2.34, we should use the glibc version to check the old
> binaries.

The patch attempts to detect old main programs by looking for the
GLIBC_2.34 symbol version.  Since we added __libc_start_main@GLIBC_2.34
(which is called from our version of _start), all standard main programs
linked with glibc 2.34 or later will have this symbol version.

> Of course, we should make a complete list of functions which are
> really implemented in libpthread.so and will be moved to libc.so in
> glibc 2.34.

I'm not sure if it is necessary to do this for *all* symbols.  Formally,
a symbol added after glibc 2.0 is not suitable for detecting the
potential multi-threaded nature of a process because the application
could be built for an earlier glibc version, where the symbol is not
available, but pthread_create can still create new threads.  The use of
pthread_mutexattr_gettype@@GLIBC_2.1 as the detection symbol does not
follow the rule, of course.  With the explicit table approach (as in the
patch), we can add additional lookup symbols later, so I think we can
start out with the GLIBC_2.0 and GLIBC_2.1 symbols plus thrd_exit (the
latter is also used by gnulib for some reason).

Thanks,
Florian



More information about the Libc-alpha mailing list