-
Notifications
You must be signed in to change notification settings - Fork 17
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
ivykis cause segment fault on arm64 #15
Comments
I think this issue might be related: #6
But it claims to be fixed in |
Yes, it is the same problem. I think problem should be my environment don't have libpthread_nonshared.a, so it still go into the if part, and week pthread_atfork. Previous fix seems only can cover case with libpthread_nonshared.a. #ifndef HAVE_LIBPTHREAD_NONSHARED Result of checking libivykis.a. I think we should also fix case without libpthread_nonshared.a, since it should not be always there. |
Hello! Thank you for the report. Linux/arm64 is one of the platforms I run the testsuite on with every release. Is this on Linux, and if yes, which distribution are you running, so that I may try to reproduce this? |
Hi, Here is the detail reproduce steps:
After qemu is bootup, we can see syslog-ng service start failed. Actually it is run below command failed. if you want to open debug and add gdb into this image, add below lines into conf/local.conf Besides, refer solution of systemd, I try to fix by replace pthread_atfork with __register_atfork. http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/baselib--register-atfork.html |
I'm having the same issue (pthread_atfork is NULL) on ARMv5, with glibc 2.28, running ArchLinuxARM. In glibc 2.28, pthread_atfork was moved from pthread_nonshared.a to libc_nonshared.a, and pthread_nonshared.a was removed. |
Thanks @Bonstra, your explanation helped me. I changed
and
and the crash is gone. |
Sorry that I haven't addressed this yet, but I still can't reproduce this. I installed a few virtual machines with Linux distributions that use glibc 2.28, and they indeed have
Does the distribution you are seeing this on not have this? (What distribution are you seeing this bug on?) I also don't see what would be ARM-specific about this issue, as I see the exact same behavior on x86_64 and on aarch64. |
This issue reports this happening on Fedora 29 for aarch64: syslog-ng/syslog-ng#2377 I installed a fresh Fedora 29 for aarch64 (by using qemu-system-aarch64), and the stock syslog-ng package indeed segfaults there:
I then downloaded the source RPM for ivykis as shipped with Fedora 29, and rebuilt it:
And then I installed the just-built ivykis packages over the stock ones:
And now I get:
This suggests to me that the Fedora 29 ivykis packages for aarch64 have been misbuilt somehow. cc @czanik |
On Fedora 29, it seems that for both aarch64 and x86_64, the However, while the x86_64
the aarch64
I'm guessing that the I'm also guessing that the I still don't understand why this also appears to be an issue when |
/lib/libc.so (glibc 2.28) on my ARMv5 ArchLinux looks like:
I don't know if this is relevant, but on my system, I have no ivykis shared library (ArchLinux doesn't even provide a libivykis package). The syslog-ng 3.18.1 tarball embeds ivykis 0.42.3, and compiles it as a static library, which is then used by the linker when creating libsyslog-ng-3.18.so.0. I rebuilt the syslog-ng packages, and the built libivykis.a contains a weak undefined symbol "pthread_atfork" (referenced from iv_signal.o), which is expected. However, despite the libc_nonshared.a in /lib/libc.so, the libsyslog-ng-3.18.so.0 still has the weak undefined "pthread_atfork" symbol. In that specific case, that could be a syslog-ng issue at link time. |
The stock Fedora 29
While a rebuilt
where the 'iv_inotify_watch_unregister' symbol is a red herring, as
In the stock
In other words, the rebuilt
So for Fedora, I would say that the problem is that their |
For ArchLinux I am guessing that the problem is because of how (BTW, there is this: https://aur.archlinux.org/packages/libivykis-git/ ) |
I noticed just now that there is a new
The changelog for this package says:
So it seems that that is all that was needed. |
@buytenh Thanks for confirming that it resolved the issue for you. ~My |
@mykarlsson Thanks for the rebuild! |
Here it is (gzipped, because Github doesn't like .so files): Alternatively, you can download the package here: |
@Bonstra Thank you for the shared library! The
Either this If I understood correctly, the syslog-ng crash on startup problem I always build
From this, it would seem that if Is there any chance you could add [*] Which I'm also not sure is an entirely sane thing to do, as it links |
That is correct. However, symlinking /usr/lib/libpthread_nonshared.a to /usr/lib/libc_nonshared.a and rebuilding produces a working libsyslog-ng.so. And I think I found out why. In And this changes everything! Quoting the System V ABI specification (emphasis by me):
So it makes sense why the resulting libsyslog-ng.so has the undefined
Here is the full build log, with The log is pretty long, but it contains all the command lines used to run the compiler and linker. The linker is invoked at line 13284 to produce libsyslog-ng.so. As you can see, at line 13990, the linker opens So, to solve this issue, I think DerDakon's pull request #16 would do the job. |
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>
@Bonstra Thank you very much for your investigation, and sorry once I was a bit stumped trying to reproduce this issue on my aarch64 VM,
Which causes this library check to succeed:
even when my If I remove my I'll apply something along the lines of the patch in pull request #16.
We do this because we want ivykis to operate correctly if we're running |
Does https://github.com/buytenh/ivykis/commits/libc-nonshared work for you? |
Sorry about the late response, but the answer it yes, it does. |
Works for me™
|
I've merged this fix as commit a5e9cad ("Avoid marking pthread_atfork() Thanks again to all involved! |
From v0.39(including), pthr_atfork function is called during loading, but for arm platform, glibc seems don't support this symbol in libpthread, so make segment fault when call it as it is NULL.
detail info please refer this link:
syslog-ng/syslog-ng#2263
The text was updated successfully, but these errors were encountered: