Skip to content

Commit 4d53484

Browse files
authored
Fix auditd -s enable hang issue (#457) (#458)
When the environment lacks libgcc_s.so.1, the program will abort when using the pthread_cancel function. When executing auditd -s enable, the parent process will hang at the become_daemon function waiting for the child process to write to init_pipe[1]. The child process calls shutdown_events at line 972 in auditd.c, which in turn calls pthread_cancel. Due to the absence of libgcc_s.so.1 in the environment, the child process is terminated here, and the parent process continues to wait because it did not receive the write to init_pipe[1] from the child process, causing the program to hang. Therefore, before calling shutdown_events, the parent process should be notified that it has already failed to ensure the parent process exits promptly. Signed-off-by: Yan Zhu <zhuyan34@huawei.com>
1 parent bf8f2b3 commit 4d53484

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/auditd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,11 +969,11 @@ int main(int argc, char *argv[])
969969
AUDIT_ATOMIC_STORE(stop, 1);
970970
send_audit_event(AUDIT_DAEMON_ABORT, emsg);
971971
audit_msg(LOG_ERR, "Unable to set audit pid, exiting");
972+
tell_parent(FAILURE);
972973
shutdown_events();
973974
if (pidfile)
974975
unlink(pidfile);
975976
shutdown_dispatcher();
976-
tell_parent(FAILURE);
977977
close_pipes();
978978
free_config(&config);
979979
ev_default_destroy();

0 commit comments

Comments
 (0)