From 3081afcb51f31c0612ac4c435e4fa857cb8df0e1 Mon Sep 17 00:00:00 2001 From: huangzq6 Date: Sat, 24 Dec 2022 18:12:13 +0800 Subject: [PATCH] fix coredump during ifp reconnect --- fix-coredump-during-ifp-reconnect.patch | 39 +++++++++++++++++++++++++ sssd.spec | 6 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 fix-coredump-during-ifp-reconnect.patch diff --git a/fix-coredump-during-ifp-reconnect.patch b/fix-coredump-during-ifp-reconnect.patch new file mode 100644 index 0000000..7b83d78 --- /dev/null +++ b/fix-coredump-during-ifp-reconnect.patch @@ -0,0 +1,39 @@ +From 0a863c853bed35ac99aa905f4e6ded6c0ab1bd3c Mon Sep 17 00:00:00 2001 +From: huangzq6 +Date: Sat, 24 Dec 2022 16:28:57 +0800 +Subject: [PATCH] fix coredump during ifp reconnect + +When the responder reconnects and gets old information in the service list (get_service_in_the_list), +the corresponding socket_activated flag will be set to false (svc->socket_activated = false). +The above behavior caused the main process to exit (monitor_quit), +did not set the corresponding destructor to NULL (talloc_set_destructor(svc->conn, NULL)), +and finally caused double-free during destructor, resulting in coredump. +Therefore, it is necessary to set the corresponding socket_activated flag to true at the end of the responder service reconnection. + +In fact, all services should have the above settings, but I have only reproduced the coredump scenario after ifp reconnection, +and other responders have not been tested for reproduction. +In order to keep the minimum modification, an if judgment is added here, and only the scene of ifp is processed. +The complete solution to this problem requires further optimization of the socket_activated setting mechanism. + +--- + src/monitor/monitor.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c +index 55cb083..af2b278 100644 +--- a/src/monitor/monitor.c ++++ b/src/monitor/monitor.c +@@ -337,6 +337,10 @@ monitor_sbus_RegisterService(TALLOC_CTX *mem_ctx, + return ret; + } + ++ if (strcasecmp(name, "ifp") == 0) { ++ svc->socket_activated = true; ++ } ++ + *_monitor_version = MONITOR_VERSION; + + return EOK; +-- +2.27.0 + diff --git a/sssd.spec b/sssd.spec index 0dc38d5..c9a4163 100644 --- a/sssd.spec +++ b/sssd.spec @@ -1,6 +1,6 @@ Name: sssd Version: 2.6.1 -Release: 7 +Release: 8 Summary: System Security Services Daemon License: GPLv3+ and LGPLv3+ URL: https://pagure.io/SSSD/sssd/ @@ -12,6 +12,7 @@ Patch6002: SDAP-sdap_get_generic_send-fix-mem-leak.patch Patch6003: sssctl-free-one-malloc-allocated-variable.patch Patch6004: PAM-P11-fixed-minor-mem-leak.patch Patch6005: SSS_CLIENT-mem-cache-fixed-missing-error-code.patch +Patch6006: fix-coredump-during-ifp-reconnect.patch Requires: python3-sssd = %{version}-%{release} Requires: libldb @@ -519,6 +520,9 @@ fi %systemd_postun_with_restart sssd.service %changelog +* Sat Dec 24 2022 huangzq6 -2.6.1-8 +- fix coredump during ifp reconnect + * Wed Dec 21 2022 zhouchenchen - 2.6.1-7 - backport some patch -- Gitee