Skip to contentSkip to conversation

allow the automount daemon to dump core

PATCH In review Jeff Moyer 2 participants 2 messages Jun 19, 2009 – Jun 21, 2009 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 allow the automount daemon to dump core

Hi,

Right now, the automount daemon blocks all signals. We should at least unblock those that will cause us to dump core. Otherwise, I think the behaviour could be, umm, interesting.

I tested this by sending SIGBUS and SIGSEGV to the automount daemon.

Cheers,
Jeff

daemon/automount.c +9 -0
index 80691fa..04fa304 100644
@@ -1324,6 +1324,10 @@ static void *statemachine(void *arg)
 	sigfillset(&signalset);
 	sigdelset(&signalset, SIGCHLD);
 	sigdelset(&signalset, SIGCONT);
+	sigdelset(&signalset, SIGBUS);
+	sigdelset(&signalset, SIGSEGV);
+	sigdelset(&signalset, SIGILL);
+	sigdelset(&signalset, SIGFPE);
 
 	while (1) {
 		sigwait(&signalset, &sig);
@@ -1817,6 +1821,11 @@ int main(int argc, char *argv[])
 	};
 
 	sigfillset(&allsigs);
+	/* allow for the dropping of core files */
+	sigdelset(&allsigs, SIGBUS);
+	sigdelset(&allsigs, SIGSEGV);
+	sigdelset(&allsigs, SIGILL);
+	sigdelset(&allsigs, SIGFPE);
 	sigprocmask(SIG_BLOCK, &allsigs, NULL);
 
 	program = argv[0];
#1 lore raw

I came up with my own patch so I could kill -ABRT when I want a core dump so I could debug at a later time. It seemed to ignore kill -SEGV and kill -ABRT. If you are going make a change could you make sure kill -ABRT makes it dump core and exit.

Here was the path that I was using:

% cat autofs-5.0.4-abortable
--- autofs-5.0.4/daemon/automount.c 2009-03-17 17:56:22.000000000 -0700
+++ autofs-5.0.4-hack1/daemon/automount.c 2009-03-17
17:56:57.000000000 -0700
@@ -1331,11 +1331,18 @@

                case SIGUSR1:
                        do_signals(master_list, sig);
                        break;
-
                case SIGHUP:
                        do_hup_signal(master_list, time(NULL));
                        break;

+ case SIGABRT:
+ abort();
+ break;
+
+ case SIGSEGV:
+ abort();
+ break;
+

                default:
                        logerr("got unexpected signal %d!", sig);
                        continue;
Quoted 41 lines · Jeff Moyer

Hi,

Right now, the automount daemon blocks all signals. We should at least unblock those that will cause us to dump core. Otherwise, I think the behaviour could be, umm, interesting.

I tested this by sending SIGBUS and SIGSEGV to the automount daemon.

Cheers,
Jeff

daemon/automount.c +9 -0
index 80691fa..04fa304 100644
@@ -1324,6 +1324,10 @@ static void *statemachine(void *arg)
       sigfillset(&signalset);
       sigdelset(&signalset, SIGCHLD);
       sigdelset(&signalset, SIGCONT);
+       sigdelset(&signalset, SIGBUS);
+       sigdelset(&signalset, SIGSEGV);
+       sigdelset(&signalset, SIGILL);
+       sigdelset(&signalset, SIGFPE);
 
       while (1) {
               sigwait(&signalset, &sig);
@@ -1817,6 +1821,11 @@ int main(int argc, char *argv[])
       };
 
       sigfillset(&allsigs);
+       /* allow for the dropping of core files */
+       sigdelset(&allsigs, SIGBUS);
+       sigdelset(&allsigs, SIGSEGV);
+       sigdelset(&allsigs, SIGILL);
+       sigdelset(&allsigs, SIGFPE);
       sigprocmask(SIG_BLOCK, &allsigs, NULL);
 
       program = argv[0];
Quoted 5 lines

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs