From 7a5851d647c21e390766b9266df4d20aa249d72a Mon Sep 17 00:00:00 2001 From: Alexey Tikhonov Date: Mon, 16 Jan 2023 14:02:21 +0100 Subject: [PATCH] Resolves: rhbz#2160001 - Reference to 'sssd-ldap-attributes' man page is missing in 'sssd-ldap', etc man pages Resolves: rhbz#2143159 - automount killed by SIGSEGV --- 0002-MAN-mention-attributes-in-see-also.patch | 29 ++++++ ..._CLIENT-delete-key-in-lib-destructor.patch | 90 +++++++++++++++++++ sssd.spec | 8 +- 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 0002-MAN-mention-attributes-in-see-also.patch create mode 100644 0003-SSS_CLIENT-delete-key-in-lib-destructor.patch diff --git a/0002-MAN-mention-attributes-in-see-also.patch b/0002-MAN-mention-attributes-in-see-also.patch new file mode 100644 index 0000000..c103d64 --- /dev/null +++ b/0002-MAN-mention-attributes-in-see-also.patch @@ -0,0 +1,29 @@ +From 897ccf40b2e7ab30c3b8a3fb42584d1d5b8c4bb3 Mon Sep 17 00:00:00 2001 +From: Alexey Tikhonov +Date: Fri, 13 Jan 2023 18:58:05 +0100 +Subject: [PATCH] MAN: mention `attributes` in 'see also' + +Reviewed-by: Justin Stephenson +Reviewed-by: Sumit Bose +(cherry picked from commit b631c3174a3f8f5c169e9507969015dd79fdfd80) +--- + src/man/include/seealso.xml | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/man/include/seealso.xml b/src/man/include/seealso.xml +index 9999496fa..7f0bbe9df 100644 +--- a/src/man/include/seealso.xml ++++ b/src/man/include/seealso.xml +@@ -10,6 +10,9 @@ + + sssd-ldap5 + , ++ ++ sssd-ldap-attributes5 ++ , + + sssd-krb55 + , +-- +2.37.3 + diff --git a/0003-SSS_CLIENT-delete-key-in-lib-destructor.patch b/0003-SSS_CLIENT-delete-key-in-lib-destructor.patch new file mode 100644 index 0000000..df981a7 --- /dev/null +++ b/0003-SSS_CLIENT-delete-key-in-lib-destructor.patch @@ -0,0 +1,90 @@ +From 45a5630e0cfe95ab90bf4a7dd1b32f418c4c759e Mon Sep 17 00:00:00 2001 +From: Alexey Tikhonov +Date: Fri, 23 Dec 2022 16:36:58 +0100 +Subject: [PATCH] SSS_CLIENT: delete key in lib destructor + +pthread_key_delete() disables thread at-exit destructors. +Otherwise an attempt to execute already unloaded `sss_at_thread_exit()` +would trigger segfault. + +This doesn't solve an issue with leaking on `dlclose()` FDs initialized in +multiple threads, but better than crash. + +Resolves: https://github.com/SSSD/sssd/issues/6505 + +Reviewed-by: Iker Pedrosa +Reviewed-by: Sumit Bose +(cherry picked from commit 08ccd23fb2c831d6ea918a59b777a0073d414858) +--- + src/sss_client/common.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/src/sss_client/common.c b/src/sss_client/common.c +index d762dff49..2c888faa9 100644 +--- a/src/sss_client/common.c ++++ b/src/sss_client/common.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -63,7 +64,8 @@ + + #ifdef HAVE_PTHREAD_EXT + static pthread_key_t sss_sd_key; +-static pthread_once_t sss_sd_key_initialized = PTHREAD_ONCE_INIT; ++static pthread_once_t sss_sd_key_init = PTHREAD_ONCE_INIT; ++static atomic_bool sss_sd_key_initialized = false; + static __thread int sss_cli_sd = -1; /* the sss client socket descriptor */ + static __thread struct stat sss_cli_sb; /* the sss client stat buffer */ + #else +@@ -71,9 +73,6 @@ static int sss_cli_sd = -1; /* the sss client socket descriptor */ + static struct stat sss_cli_sb; /* the sss client stat buffer */ + #endif + +-#if HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR +-__attribute__((destructor)) +-#endif + void sss_cli_close_socket(void) + { + if (sss_cli_sd != -1) { +@@ -91,9 +90,24 @@ static void sss_at_thread_exit(void *v) + static void init_sd_key(void) + { + pthread_key_create(&sss_sd_key, sss_at_thread_exit); ++ sss_sd_key_initialized = true; ++} ++#endif ++ ++#if HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR ++__attribute__((destructor)) void sss_at_lib_unload(void) ++{ ++#ifdef HAVE_PTHREAD_EXT ++ if (sss_sd_key_initialized) { ++ sss_sd_key_initialized = false; ++ pthread_key_delete(sss_sd_key); ++ } ++#endif ++ sss_cli_close_socket(); + } + #endif + ++ + /* Requests: + * + * byte 0-3: 32bit unsigned with length (the complete packet length: 0 to X) +@@ -572,7 +586,7 @@ static int sss_cli_open_socket(int *errnop, const char *socket_name, int timeout + } + + #ifdef HAVE_PTHREAD_EXT +- pthread_once(&sss_sd_key_initialized, init_sd_key); /* once for all threads */ ++ pthread_once(&sss_sd_key_init, init_sd_key); /* once for all threads */ + + /* It actually doesn't matter what value to set for a key. + * The only important thing: key must be non-NULL to ensure +-- +2.37.3 + diff --git a/sssd.spec b/sssd.spec index d5ed30c..f598498 100644 --- a/sssd.spec +++ b/sssd.spec @@ -27,7 +27,7 @@ Name: sssd Version: 2.8.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: System Security Services Daemon License: GPLv3+ URL: https://github.com/SSSD/sssd/ @@ -35,6 +35,8 @@ Source0: https://github.com/SSSD/sssd/releases/download/%{version}/sssd-%{versio ### Patches ### Patch0001: 0001-ldap-update-shadow-last-change-in-sysdb-as-well.patch +Patch0002: 0002-MAN-mention-attributes-in-see-also.patch +Patch0003: 0003-SSS_CLIENT-delete-key-in-lib-destructor.patch ### Dependencies ### @@ -1060,6 +1062,10 @@ fi %systemd_postun_with_restart sssd.service %changelog +* Mon Jan 16 2023 Alexey Tikhonov - 2.8.2-2 +- Resolves: rhbz#2160001 - Reference to 'sssd-ldap-attributes' man page is missing in 'sssd-ldap', etc man pages +- Resolves: rhbz#2143159 - automount killed by SIGSEGV + * Fri Dec 16 2022 Alexey Tikhonov - 2.8.2-1 - Resolves: rhbz#2127510 - Rebase SSSD for RHEL 9.2 - Resolves: rhbz#1608496 - sssd failing to register dynamic DNS addresses against an AD server due to unnecessary DNS search