- fix an RPC fd leak.
- don't block signals we expect to dump core. - fix pthread push order in expire_proc_direct().
This commit is contained in:
parent
5d76ad9186
commit
a347ae035b
83
autofs-5.0.4-allow-automount-daemon-to-dump-core.patch
Normal file
83
autofs-5.0.4-allow-automount-daemon-to-dump-core.patch
Normal file
@ -0,0 +1,83 @@
|
||||
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(sigset));
|
||||
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];
|
||||
|
165
autofs-5.0.4-fix-map-type-info-parse-error-update.patch
Normal file
165
autofs-5.0.4-fix-map-type-info-parse-error-update.patch
Normal file
@ -0,0 +1,165 @@
|
||||
autofs-5.0.4 - fix map type info parse error update
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Make parsing map type info more robust.
|
||||
---
|
||||
|
||||
lib/parse_subs.c | 123 +++++++++++++++++++++++++++++++++++++++++++++---------
|
||||
1 files changed, 102 insertions(+), 21 deletions(-)
|
||||
|
||||
|
||||
diff --git a/lib/parse_subs.c b/lib/parse_subs.c
|
||||
index 0608cb7..2326838 100644
|
||||
--- a/lib/parse_subs.c
|
||||
+++ b/lib/parse_subs.c
|
||||
@@ -20,6 +20,30 @@
|
||||
#include <ctype.h>
|
||||
#include "automount.h"
|
||||
|
||||
+struct types {
|
||||
+ char *type;
|
||||
+ unsigned int len;
|
||||
+};
|
||||
+
|
||||
+static struct types map_type[] = {
|
||||
+ { "file", 4 },
|
||||
+ { "program", 7 },
|
||||
+ { "yp", 2 },
|
||||
+ { "nis", 3 },
|
||||
+ { "nisplus", 7 },
|
||||
+ { "ldap", 4 },
|
||||
+ { "ldaps", 5 },
|
||||
+ { "hesiod", 6 },
|
||||
+ { "userdir", 7 },
|
||||
+};
|
||||
+static unsigned int map_type_count = sizeof(map_type)/sizeof(struct types);
|
||||
+
|
||||
+static struct types format_type[] = {
|
||||
+ { "sun", 3 },
|
||||
+ { "hesiod", 6 },
|
||||
+};
|
||||
+static unsigned int format_type_count = sizeof(format_type)/sizeof(struct types);
|
||||
+
|
||||
/*
|
||||
* Skip whitespace in a string; if we hit a #, consider the rest of the
|
||||
* entry a comment.
|
||||
@@ -315,7 +339,7 @@ struct map_type_info *parse_map_type_info(const char *str)
|
||||
{
|
||||
struct map_type_info *info;
|
||||
char *buf, *type, *fmt, *map, *tmp;
|
||||
- int seen_colon = 0;
|
||||
+ char *pos;
|
||||
|
||||
buf = strdup(str);
|
||||
if (!buf)
|
||||
@@ -328,32 +352,89 @@ struct map_type_info *parse_map_type_info(const char *str)
|
||||
}
|
||||
memset(info, 0, sizeof(struct map_type_info));
|
||||
|
||||
- type = fmt = NULL;
|
||||
+ type = fmt = map = NULL;
|
||||
+
|
||||
+ tmp = strchr(buf, ':');
|
||||
+ if (!tmp) {
|
||||
+ pos = buf;
|
||||
+ while (*pos == ' ')
|
||||
+ *pos++ = '\0';
|
||||
+ map = pos;
|
||||
+ } else {
|
||||
+ int i, j;
|
||||
+
|
||||
+ for (i = 0; i < map_type_count; i++) {
|
||||
+ char *m_type = map_type[i].type;
|
||||
+ unsigned int m_len = map_type[i].len;
|
||||
+
|
||||
+ pos = buf;
|
||||
+
|
||||
+ if (strncmp(m_type, pos, m_len))
|
||||
+ continue;
|
||||
+
|
||||
+ type = pos;
|
||||
+ pos += m_len;
|
||||
+
|
||||
+ if (*pos == ' ' || *pos == ':') {
|
||||
+ while (*pos == ' ')
|
||||
+ *pos++ = '\0';
|
||||
+ if (*pos != ':') {
|
||||
+ free(buf);
|
||||
+ free(info);
|
||||
+ return NULL;
|
||||
+ } else {
|
||||
+ *pos++ = '\0';
|
||||
+ while (*pos == ' ')
|
||||
+ *pos++ = '\0';
|
||||
+ map = pos;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (*pos == ',') {
|
||||
+ *pos++ = '\0';
|
||||
+ for (j = 0; j < format_type_count; j++) {
|
||||
+ char *f_type = format_type[j].type;
|
||||
+ unsigned int f_len = format_type[j].len;
|
||||
+
|
||||
+ if (strncmp(f_type, pos, f_len))
|
||||
+ continue;
|
||||
+
|
||||
+ fmt = pos;
|
||||
+ pos += f_len;
|
||||
+
|
||||
+ if (*pos == ' ' || *pos == ':') {
|
||||
+ while (*pos == ' ')
|
||||
+ *pos++ = '\0';
|
||||
+ if (*pos != ':') {
|
||||
+ free(buf);
|
||||
+ free(info);
|
||||
+ return NULL;
|
||||
+ } else {
|
||||
+ *pos++ = '\0';
|
||||
+ while (*pos == ' ')
|
||||
+ *pos++ = '\0';
|
||||
+ map = pos;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!type) {
|
||||
+ pos = buf;
|
||||
+ while (*pos == ' ')
|
||||
+ *pos++ = '\0';
|
||||
+ map = pos;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/* Look for space terminator - ignore local options */
|
||||
- map = buf;
|
||||
for (tmp = buf; *tmp; tmp++) {
|
||||
if (*tmp == ' ') {
|
||||
*tmp = '\0';
|
||||
break;
|
||||
- } else if (!seen_colon && *tmp == ',') {
|
||||
- type = buf;
|
||||
- *tmp++ = '\0';
|
||||
- fmt = tmp;
|
||||
- } else if (*tmp == ':') {
|
||||
- seen_colon = 1;
|
||||
- if (!fmt)
|
||||
- type = buf;
|
||||
- *tmp++ = '\0';
|
||||
- map = tmp;
|
||||
- } else if (*tmp == '[') {
|
||||
- /*
|
||||
- * Unescaped '[' is a syntax error here as only
|
||||
- * an ldap map with a type specified should contain
|
||||
- * them.
|
||||
- */
|
||||
- free(buf);
|
||||
- return 0;
|
||||
}
|
||||
if (*tmp == '\\')
|
||||
tmp++;
|
@ -0,0 +1,36 @@
|
||||
autofs-5.0.4 - fix pthread push order in expire_proc_direct()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Apparently the pthread_cleanup_push() has the quite stupid semantic
|
||||
of not working properly if the value of the pointer passed to it
|
||||
changes after it has been called.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
daemon/direct.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
|
||||
--- autofs-5.0.4.orig/CHANGELOG
|
||||
+++ autofs-5.0.4/CHANGELOG
|
||||
@@ -58,6 +58,7 @@
|
||||
- fix map type info parse error.
|
||||
- fix an RPC fd leak.
|
||||
- don't block signals we expect to dump core.
|
||||
+- fix pthread push order in expire_proc_direct().
|
||||
|
||||
4/11/2008 autofs-5.0.4
|
||||
-----------------------
|
||||
--- autofs-5.0.4.orig/daemon/direct.c
|
||||
+++ autofs-5.0.4/daemon/direct.c
|
||||
@@ -823,8 +823,8 @@ void *expire_proc_direct(void *arg)
|
||||
|
||||
left = 0;
|
||||
|
||||
- pthread_cleanup_push(mnts_cleanup, mnts);
|
||||
mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/");
|
||||
+ pthread_cleanup_push(mnts_cleanup, mnts);
|
||||
|
||||
/* Get a list of mounts select real ones and expire them if possible */
|
||||
INIT_LIST_HEAD(&list);
|
47
autofs-5.0.4-fix-rpc-fd-leak.patch
Normal file
47
autofs-5.0.4-fix-rpc-fd-leak.patch
Normal file
@ -0,0 +1,47 @@
|
||||
autofs-5.0.4 - fix rpc fd leak
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Recent changes which introduced the ability to handle to cope with
|
||||
IPv6 addresses causes a file descriptor leak in the RPC library.
|
||||
---
|
||||
|
||||
CHANGELOG | 1 +
|
||||
lib/rpc_subs.c | 11 -----------
|
||||
2 files changed, 1 insertions(+), 11 deletions(-)
|
||||
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 3fd97d3..9edb113 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -56,6 +56,7 @@
|
||||
- fix double free in sasl_bind().
|
||||
- mannual umount recovery fixes.
|
||||
- fix map type info parse error.
|
||||
+- fix an RPC fd leak.
|
||||
|
||||
4/11/2008 autofs-5.0.4
|
||||
-----------------------
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index d034b29..cafc775 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -253,17 +253,6 @@ static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *inf
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (!info->client) {
|
||||
- *fd = open_sock(addr->sa_family, type, proto);
|
||||
- if (*fd < 0)
|
||||
- return NULL;
|
||||
-
|
||||
- if (bind(*fd, laddr, slen) < 0) {
|
||||
- close(*fd);
|
||||
- return NULL;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
switch (info->proto->p_proto) {
|
||||
case IPPROTO_UDP:
|
||||
if (!info->client) {
|
15
autofs.spec
15
autofs.spec
@ -4,7 +4,7 @@
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.0.4
|
||||
Release: 30
|
||||
Release: 32
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
@ -68,6 +68,10 @@ Patch55: autofs-5.0.4-remount-we-created-mount-point-fix.patch
|
||||
Patch56: autofs-5.0.4-fix-double-free-in-do_sasl_bind.patch
|
||||
Patch57: autofs-5.0.4-manual-umount-recovery-fixes.patch
|
||||
Patch58: autofs-5.0.4-fix-map-type-info-parse-error.patch
|
||||
Patch59: autofs-5.0.4-fix-map-type-info-parse-error-update.patch
|
||||
Patch60: autofs-5.0.4-fix-rpc-fd-leak.patch
|
||||
Patch61: autofs-5.0.4-allow-automount-daemon-to-dump-core.patch
|
||||
Patch62: autofs-5.0.4-fix-pthread-push-order-in-expire_proc_direct.patch
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
|
||||
Requires: kernel >= 2.6.17
|
||||
@ -167,6 +171,10 @@ echo %{version}-%{release} > .version
|
||||
%patch56 -p1
|
||||
%patch57 -p1
|
||||
%patch58 -p1
|
||||
%patch59 -p1
|
||||
%patch60 -p1
|
||||
%patch61 -p1
|
||||
%patch62 -p1
|
||||
|
||||
%build
|
||||
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
|
||||
@ -219,6 +227,11 @@ fi
|
||||
%{_libdir}/autofs/
|
||||
|
||||
%changelog
|
||||
* Wed Jul 15 2009 Ian Kent <ikent@redhat.com> - 1:5.0.4-32
|
||||
- fix an RPC fd leak.
|
||||
- don't block signals we expect to dump core.
|
||||
- fix pthread push order in expire_proc_direct().
|
||||
|
||||
* Fri Jun 12 2009 Ian Kent <ikent@redhat.com> - 1:5.0.4-30
|
||||
- fix incorrect dclist free.
|
||||
- srv lookup handle endianness.
|
||||
|
Loading…
Reference in New Issue
Block a user