autofs-5.0.4 - allow the automount daemon to dump core
From: Jeff Moyer <jmoyer@redhat.com>
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.
edit - raven
- I changed this a little so that the change to the signals is
done in one place and added SIGABRT and SIGTRAP to the list
of signals that aren't blocked.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
CHANGELOG | 1 +
daemon/automount.c | 16 ++++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 7f27f5e..4b85649 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -57,6 +57,7 @@
- mannual umount recovery fixes.
- fix map type info parse error.
- fix an RPC fd leak.
+- don't block signals we expect to dump core.
4/11/2008 autofs-5.0.4
-----------------------
diff --git a/daemon/automount.c b/daemon/automount.c
index 44dcdd6..e7f801b 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -64,6 +64,8 @@ static int st_stat = 1;
static int *pst_stat = &st_stat;
static pthread_t state_mach_thid;
+static sigset_t block_sigs;
+
/* Pre-calculated kernel packet length */
static size_t kpkt_len;
@@ -1321,7 +1323,7 @@ static void *statemachine(void *arg)
sigset_t signalset;
int sig;
- sigfillset(&signalset);
+ memcpy(&signalset, &block_sigs, sizeof(signalset));
sigdelset(&signalset, SIGCHLD);
sigdelset(&signalset, SIGCONT);
@@ -1817,7 +1819,6 @@ int main(int argc, char *argv[])
unsigned foreground, have_global_options;
time_t timeout;
time_t age = time(NULL);
- sigset_t allsigs;
struct rlimit rlim;
static const struct option long_options[] = {
{"help", 0, 0, 'h'},
@@ -1837,8 +1838,15 @@ int main(int argc, char *argv[])
{0, 0, 0, 0}
};
- sigfillset(&allsigs);
- sigprocmask(SIG_BLOCK, &allsigs, NULL);
+ sigfillset(&block_sigs);
+ /* allow for the dropping of core files */
+ sigdelset(&block_sigs, SIGABRT);
+ sigdelset(&block_sigs, SIGBUS);
+ sigdelset(&block_sigs, SIGSEGV);
+ sigdelset(&block_sigs, SIGILL);
+ sigdelset(&block_sigs, SIGFPE);
+ sigdelset(&block_sigs, SIGTRAP);
+ sigprocmask(SIG_BLOCK, &block_sigs, NULL);
program = argv[0];