git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-daemon: fix segfaulting in child_handler() in AIX

From
Seth Jennings <spartacus06@gmail.com>
Date
Apr 15, 2011, 16:51 UTC
Message-ID
<1302886260-25860-1-git-send-email-spartacus06@gmail.com>

This issue seems to be specific to git-daemon on AIX built with xlc. After commit 695605b5080e1957bd9dab1fed35a7fee9814297 (from Aug 2008), git-daemon segfaults in child_handler() inside the signal() syscall immediately after any remote clone/pull operation. While it is not fully understood why this happens, changing signal() to sigaction() resolves the issue.

This commit converts singal() to sigaction() in child_handler().
---
 daemon.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/daemon.c b/daemon.c
index 4c8346d..3ea5b2c 100644
--- a/daemon.c
+++ b/daemon.c
@@ -715,7 +715,10 @@ static void child_handler(int signo)
 	 * upon signal receipt
 	 * SysV needs the handler to be rearmed
 	 */
-	signal(SIGCHLD, child_handler);
+	struct sigaction sigact;
+	memset(&sigact, 0, sizeof(sigact));
+	sigact.sa_handler = child_handler;
+	sigaction(SIGCHLD, &sigact, NULL);
 }
 
 static int set_reuse_addr(int sockfd)
@@ -889,7 +892,10 @@ static int service_loop(struct socketlist *socklist)
 		pfd[i].events = POLLIN;
 	}
 
-	signal(SIGCHLD, child_handler);
+	struct sigaction sigact;
+	memset(&sigact, 0, sizeof(sigact));
+	sigact.sa_handler = child_handler;
+	sigaction(SIGCHLD, &sigact, NULL);
 
 	for (;;) {
 		int i;
-- 
1.7.0.4
Next: Seth Jennings
Message 1 of 5 in “git-daemon: fix segfaulting in child_handler() in AIX”
  1. git-daemon: fix segfaulting in child_handler() in AIXSeth Jennings, Apr 15, 2011
  2. Seth JenningsApr 15, 2011
  3. Christian CouderApr 20, 2011
  4. Seth JenningsMay 2, 2011
  5. Erik Faye-LundApr 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.