diff options
| author | Changqing Li <changqing.li@windriver.com> | 2018-09-17 16:17:52 +0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2018-09-17 22:19:53 -0700 |
| commit | d2120afea7698a65864784983aa739a81f7b3bcf (patch) | |
| tree | ff155321be599122537e8fcafad9a0590846481b | |
| parent | c6c4e5457864644190d442e8cbf8110d7b087da5 (diff) | |
| download | meta-openembedded-d2120afea7698a65864784983aa739a81f7b3bcf.tar.gz | |
syslog-ng: fix segment fault during startup on arm64
service start failed since segment fault on arch arm64,
syslog-ng have a submodule ivykis, from ivykis V0.42,
it use pthread_atfork, but for arm64, this symbol is
not included by libpthread, so cause segment fault.
refer systemd, replace pthread_atfork with __register_atfork
to fix this problem.
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-support/syslog-ng/files/0001-syslog-ng-fix-segment-fault-during-service-start.patch | 75 | ||||
| -rw-r--r-- | meta-oe/recipes-support/syslog-ng/syslog-ng_3.16.1.bb | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/syslog-ng/files/0001-syslog-ng-fix-segment-fault-during-service-start.patch b/meta-oe/recipes-support/syslog-ng/files/0001-syslog-ng-fix-segment-fault-during-service-start.patch new file mode 100644 index 0000000000..0fc40be4a9 --- /dev/null +++ b/meta-oe/recipes-support/syslog-ng/files/0001-syslog-ng-fix-segment-fault-during-service-start.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | From caeccb7bec45f65bc89efa8195b3853368328361 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Changqing Li <changqing.li@windriver.com> | ||
| 3 | Date: Mon, 17 Sep 2018 12:49:36 +0800 | ||
| 4 | Subject: [PATCH] syslog-ng: fix segment fault during service start on arm64 | ||
| 5 | |||
| 6 | service start failed since segment fault on arch arm64, | ||
| 7 | syslog-ng have a submodule ivykis, from ivykis V0.42, | ||
| 8 | it use pthread_atfork, but for arm64, this symbol is | ||
| 9 | not included by libpthread, so cause segment fault. | ||
| 10 | |||
| 11 | refer systemd, replace pthread_atfork with __register_atfork | ||
| 12 | to fix this problem. | ||
| 13 | |||
| 14 | I have create an issue, and this proposal to upstream. | ||
| 15 | https://github.com/buytenh/ivykis/issues/15 | ||
| 16 | |||
| 17 | Upstream-Status: Pending | ||
| 18 | |||
| 19 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 20 | --- | ||
| 21 | lib/ivykis/src/pthr.h | 24 ++++++++++++------------ | ||
| 22 | 1 file changed, 12 insertions(+), 12 deletions(-) | ||
| 23 | |||
| 24 | diff --git a/lib/ivykis/src/pthr.h b/lib/ivykis/src/pthr.h | ||
| 25 | index a41eaf3..72c5190 100644 | ||
| 26 | --- a/lib/ivykis/src/pthr.h | ||
| 27 | +++ b/lib/ivykis/src/pthr.h | ||
| 28 | @@ -24,6 +24,16 @@ | ||
| 29 | #include <pthread.h> | ||
| 30 | #include <signal.h> | ||
| 31 | |||
| 32 | +#ifdef __GLIBC__ | ||
| 33 | +/* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc | ||
| 34 | + * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against | ||
| 35 | + * libpthread, as it is part of glibc anyway. */ | ||
| 36 | +extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void * __dso_handle); | ||
| 37 | +extern void* __dso_handle __attribute__ ((__weak__)); | ||
| 38 | +#else | ||
| 39 | +#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child) | ||
| 40 | +#endif | ||
| 41 | + | ||
| 42 | #ifdef HAVE_PRAGMA_WEAK | ||
| 43 | #pragma weak pthread_create | ||
| 44 | #endif | ||
| 45 | @@ -36,16 +46,7 @@ static inline int pthreads_available(void) | ||
| 46 | |||
| 47 | #ifdef HAVE_PRAGMA_WEAK | ||
| 48 | |||
| 49 | -/* | ||
| 50 | - * On Linux, pthread_atfork() is defined in libpthread_nonshared.a, | ||
| 51 | - * a static library, and we want to avoid "#pragma weak" for that | ||
| 52 | - * symbol because that causes it to be undefined even if you link | ||
| 53 | - * libpthread_nonshared.a in explicitly. | ||
| 54 | - */ | ||
| 55 | -#ifndef HAVE_LIBPTHREAD_NONSHARED | ||
| 56 | -#pragma weak pthread_atfork | ||
| 57 | -#endif | ||
| 58 | - | ||
| 59 | +#pragma weak __register_atfork | ||
| 60 | #pragma weak pthread_create | ||
| 61 | #pragma weak pthread_detach | ||
| 62 | #pragma weak pthread_getspecific | ||
| 63 | @@ -73,8 +74,7 @@ static inline int | ||
| 64 | pthr_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) | ||
| 65 | { | ||
| 66 | if (pthreads_available()) | ||
| 67 | - return pthread_atfork(prepare, parent, child); | ||
| 68 | - | ||
| 69 | + return __register_atfork(prepare, parent, child, __dso_handle); | ||
| 70 | return ENOSYS; | ||
| 71 | } | ||
| 72 | |||
| 73 | -- | ||
| 74 | 2.7.4 | ||
| 75 | |||
diff --git a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.16.1.bb b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.16.1.bb index 2fd57fb93c..b5f42cf988 100644 --- a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.16.1.bb +++ b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.16.1.bb | |||
| @@ -9,6 +9,7 @@ SRC_URI = "https://github.com/balabit/syslog-ng/releases/download/${BP}/${BP}.ta | |||
| 9 | file://fix-config-libnet.patch \ | 9 | file://fix-config-libnet.patch \ |
| 10 | file://fix-invalid-ownership.patch \ | 10 | file://fix-invalid-ownership.patch \ |
| 11 | file://syslog-ng.service-the-syslog-ng-service.patch \ | 11 | file://syslog-ng.service-the-syslog-ng-service.patch \ |
| 12 | file://0001-syslog-ng-fix-segment-fault-during-service-start.patch \ | ||
| 12 | " | 13 | " |
| 13 | 14 | ||
| 14 | SRC_URI[md5sum] = "72d44ad02c2e9ba0748b3ecd3f15a7ff" | 15 | SRC_URI[md5sum] = "72d44ad02c2e9ba0748b3ecd3f15a7ff" |
