-
Notifications
You must be signed in to change notification settings - Fork 18
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
look for pthread_atfork() also in lib c_nonshared #16
Conversation
Newer versions of glibc do not have pthread_nonshared anymore, instead the symbol is in c_nonshared. This fixes a crash on start on those platforms (namely with syslog-ng). Signed-off-by: Rolf Eike Beer <eb@emlix.com>
We added this to Gentoo Linux and it fixed the segfault on ppc64 - https://bugs.gentoo.org/675338. |
The fix from the pull request seems to fix this, and syslog-ng is (understandably) not very keen on pulling an ivykis fix which isn't upstream. Is there any chance of getting this pulled soon? |
syslog-ng may segfault at startup (during library initialization, before reaching main) in newer toolchains. I have witnessed it on aarch64 (but with 32-bit arm userland) with glibc 2.28. Problem is described in syslog-ng issue #2263 [1], which in turn leads to a problem in 'ivykis' which is shipped with syslog-ng, see ivykis issue #15 [2]. Root cause is that 'pthread_atfork' is used by ivykis but searched by its configure script in libpthread_nonshared only. In newer toolchains, it seems this symbol is in libc_nonshared. Apply a patch someone proposed via pullrequest [3] to the ivykis project, but which is at this moment not yet merged upstream. [1] syslog-ng/syslog-ng#2263 [2] buytenh/ivykis#15 [3] buytenh/ivykis#16 Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
syslog-ng may segfault at startup (during library initialization, before reaching main) in newer toolchains. I have witnessed it on aarch64 (but with 32-bit arm userland) with glibc 2.28. Problem is described in syslog-ng issue #2263 [1], which in turn leads to a problem in 'ivykis' which is shipped with syslog-ng, see ivykis issue #15 [2]. Root cause is that 'pthread_atfork' is used by ivykis but searched by its configure script in libpthread_nonshared only. In newer toolchains, it seems this symbol is in libc_nonshared. Apply a patch someone proposed via pullrequest [3] to the ivykis project, but which is at this moment not yet merged upstream. [1] syslog-ng/syslog-ng#2263 [2] buytenh/ivykis#15 [3] buytenh/ivykis#16 Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit d1467ea) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
ping? |
@hydrapolic @hbakken @DerDakon Just for my information, do you also get |
Yes, unless the above-mentioned patch is applied to ivykis, it still crashes. |
@hbakken OK, thank you for testing. Could you please upload a build (My only aarch64 environment is emulated via QEMU and everything |
Uh, sorry, I haven't tested in a while, and I need to build a new os base for my embedded system to trigger the bug, which takes a bit, so that's going to be a bit of a hassle. |
...so it seems I need to clarify my previous comment: That was the case back on April 1st. If any of the commits on ivykis since then has fixed this, I haven't tested it. I did, however, try to build syslog-ng against ivykis as of ~1 Apr, and it failed. |
I have a reproduction of this issue on a public arm64 server (without syslog-ng). Basically, the following example program and glibc 2.28 are needed: #define _POSIX_C_SOURCE 200809L
#include <iv.h>
int main()
{
iv_init();
iv_main();
iv_deinit();
} $ gcc -std=c99 -Wall -Wextra -Werror -g -pthread ivykis-reprod.c -o ivykis-reprod -livykis
$ nm -g /usr/lib/aarch64-linux-gnu/libc_nonshared.a | grep atfork
pthread_atfork.oS:
0000000000000000 T __pthread_atfork
0000000000000000 W pthread_atfork
U __register_atfork |
I think I understand this a bit better now (see the update on issue #15). It seems that we don't even need to pull in
That is, merely the not marking of |
Does https://github.com/buytenh/ivykis/commits/libc-nonshared work for you? |
I've had positive feedback for this fix, so I've merged it as commit Thanks again to all involved! |
Thank you |
Newer versions of glibc do not have pthread_nonshared anymore, instead the symbol is in c_nonshared. This fixes a crash on start on those platforms (namely with syslog-ng).
The fix was inspired by #15 (comment).