sssd/fix-coredump-during-ifp-reconnect.patch
2022-12-24 18:05:22 +08:00

40 lines
1.6 KiB
Diff

From 0a863c853bed35ac99aa905f4e6ded6c0ab1bd3c Mon Sep 17 00:00:00 2001
From: huangzq6 <huangzhenqiang2@huawei.com>
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