osmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31911 ) Change subject: on_dso_load_select: run after on_dso_load_ctx ...................................................................... on_dso_load_select: run after on_dso_load_ctx Add priorities to ensure on_dso_load_select runs after on_dso_load_ctx. Otherwise osmo_ctx->global (used via define OTC_GLOBAL) points to NULL and causes a segfault in osmo_fd_lookup_table_extend. Use numbers 101 and 102, as "0 to 100 are reserved for the implementation" and cause an error from GCC. Fixes: OS#5946 Fixes: c46a15d8 ("select: Optimize osmo_fd_get_by_fd") Change-Id: Ia2518e82530b93c535f8f5105513e21559b895ba --- M src/core/context.c M src/core/select.c 2 files changed, 22 insertions(+), 3 deletions(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/core/context.c b/src/core/context.c index 6b58565..a0b3a55 100644 --- a/src/core/context.c +++ b/src/core/context.c @@ -39,7 +39,7 @@ } /* initialize osmo_ctx on main tread */ -static __attribute__((constructor)) void on_dso_load_ctx(void) +static __attribute__((constructor(101))) void on_dso_load_ctx(void) { OSMO_ASSERT(osmo_ctx_init("main") == 0); } diff --git a/src/core/select.c b/src/core/select.c index c60cd8e..69fa763 100644 --- a/src/core/select.c +++ b/src/core/select.c @@ -534,8 +534,9 @@ osmo_fd_lookup_table_extend(0); } -/* ensure main thread always has pre-initialized osmo_fds */ -static __attribute__((constructor)) void on_dso_load_select(void) +/* ensure main thread always has pre-initialized osmo_fds + * priority 102: must run after on_dso_load_ctx */ +static __attribute__((constructor(102))) void on_dso_load_select(void) { osmo_select_init(); } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31911 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Ia2518e82530b93c535f8f5105513e21559b895ba Gerrit-Change-Number: 31911 Gerrit-PatchSet: 4 Gerrit-Owner: osmith <osmith@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged