Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 275541 Details for
Bug 233481
SELinux audit messages "/bin/umount (mount_t) "read write" to socket:[NNN] (automount_t)"
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Attempt to use mutex to prevent leaked file descriptors on exec()
autofs-5.0.1-fd-close-on-exec-mutex.patch (text/plain), 19.30 KB, created by
Ian Kent
on 2007-12-03 10:03:54 UTC
(
hide
)
Description:
Attempt to use mutex to prevent leaked file descriptors on exec()
Filename:
MIME Type:
Creator:
Ian Kent
Created:
2007-12-03 10:03:54 UTC
Size:
19.30 KB
patch
obsolete
>diff -up autofs-5.0.1/modules/mount_changer.c.fd-close-on-exec-mutex autofs-5.0.1/modules/mount_changer.c >--- autofs-5.0.1/modules/mount_changer.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/modules/mount_changer.c 2007-12-03 18:48:59.000000000 +0900 >@@ -34,6 +34,8 @@ > > #define MODPREFIX "mount(changer): " > >+extern pthread_mutex_t fd_mutex; >+ > int mount_version = AUTOFS_MOUNT_VERSION; /* Required by protocol */ > > int swapCD(const char *device, const char *slotName); >@@ -158,11 +160,18 @@ int swapCD(const char *device, const cha > > slot = atoi(slotName) - 1; > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* open device */ > fd = open(device, O_RDONLY | O_NONBLOCK); > if (fd < 0) { > logerr(MODPREFIX "Opening device %s failed : %s", > device, strerror(errno)); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return 1; > } > >@@ -171,6 +180,10 @@ int swapCD(const char *device, const cha > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Check CD player status */ > total_slots_available = ioctl(fd, CDROM_CHANGER_NSLOTS); > if (total_slots_available <= 1) { >diff -up autofs-5.0.1/modules/replicated.c.fd-close-on-exec-mutex autofs-5.0.1/modules/replicated.c >--- autofs-5.0.1/modules/replicated.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/modules/replicated.c 2007-12-03 18:48:59.000000000 +0900 >@@ -74,6 +74,8 @@ > #define max(x, y) (x >= y ? x : y) > #define mmax(x, y, z) (max(x, y) == x ? max(x, z) : max(y, z)) > >+extern pthread_mutex_t fd_mutex; >+ > void seed_random(void) > { > int fd; >@@ -102,7 +104,7 @@ static unsigned int get_proximity(const > char tmp[20], buf[MAX_ERR_BUF], *ptr; > struct ifconf ifc; > struct ifreq *ifr, nmptr; >- int sock, cl_flags, ret, i; >+ int sock, cl_flags, ret, i, status; > uint32_t mask, ha, ia; > > memcpy(tmp, host_addr, addr_len); >@@ -110,10 +112,17 @@ static unsigned int get_proximity(const > > ha = ntohl((uint32_t) hst_addr->s_addr); > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > sock = socket(AF_INET, SOCK_DGRAM, 0); > if (sock < 0) { > char *estr = strerror_r(errno, buf, MAX_ERR_BUF); > logerr("socket creation failed: %s", estr); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return PROXIMITY_ERROR; > } > >@@ -122,6 +131,10 @@ static unsigned int get_proximity(const > fcntl(sock, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > ifc.ifc_len = sizeof(buf); > ifc.ifc_req = (struct ifreq *) buf; > ret = ioctl(sock, SIOCGIFCONF, &ifc); >diff -up autofs-5.0.1/modules/lookup_file.c.fd-close-on-exec-mutex autofs-5.0.1/modules/lookup_file.c >--- autofs-5.0.1/modules/lookup_file.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/modules/lookup_file.c 2007-12-03 18:48:59.000000000 +0900 >@@ -36,6 +36,8 @@ > > #define MAX_INCLUDE_DEPTH 16 > >+extern pthread_mutex_t fd_mutex; >+ > typedef enum { > st_begin, st_compare, st_star, st_badent, st_entspc, st_getent > } LOOKUP_STATE; >@@ -399,7 +401,7 @@ int lookup_read_master(struct master *ma > char *ent; > struct stat st; > FILE *f; >- int fd, cl_flags; >+ int fd, cl_flags, status; > unsigned int path_len, ent_len; > int entry, cur_state; > >@@ -426,11 +428,18 @@ int lookup_read_master(struct master *ma > return NSS_STATUS_UNAVAIL; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > f = fopen(ctxt->mapname, "r"); > if (!f) { > error(logopt, > MODPREFIX "could not open master map file %s", > ctxt->mapname); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return NSS_STATUS_UNAVAIL; > } > >@@ -441,6 +450,10 @@ int lookup_read_master(struct master *ma > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > while(1) { > entry = read_one(logopt, f, path, &path_len, ent, &ent_len); > if (!entry) { >@@ -644,7 +657,7 @@ int lookup_read_map(struct autofs_point > char *mapent; > struct stat st; > FILE *f; >- int fd, cl_flags; >+ int fd, cl_flags, status; > unsigned int k_len, m_len; > int entry; > >@@ -677,10 +690,17 @@ int lookup_read_map(struct autofs_point > return NSS_STATUS_UNAVAIL; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > f = fopen(ctxt->mapname, "r"); > if (!f) { > error(ap->logopt, > MODPREFIX "could not open map file %s", ctxt->mapname); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return NSS_STATUS_UNAVAIL; > } > >@@ -691,6 +711,10 @@ int lookup_read_map(struct autofs_point > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > while(1) { > entry = read_one(ap->logopt, f, key, &k_len, mapent, &m_len); > if (!entry) { >@@ -777,7 +801,7 @@ static int lookup_one(struct autofs_poin > char mapent[MAPENT_MAX_LEN + 1]; > time_t age = time(NULL); > FILE *f; >- int fd, cl_flags; >+ int fd, cl_flags, status; > unsigned int k_len, m_len; > int entry, ret; > >@@ -787,10 +811,17 @@ static int lookup_one(struct autofs_poin > > mc = source->mc; > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > f = fopen(ctxt->mapname, "r"); > if (!f) { > error(ap->logopt, > MODPREFIX "could not open map file %s", ctxt->mapname); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return CHE_FAIL; > } > >@@ -801,6 +832,10 @@ static int lookup_one(struct autofs_poin > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > while(1) { > entry = read_one(ap->logopt, f, mkey, &k_len, mapent, &m_len); > if (entry) { >@@ -890,7 +925,7 @@ static int lookup_wild(struct autofs_poi > char mapent[MAPENT_MAX_LEN + 1]; > time_t age = time(NULL); > FILE *f; >- int fd, cl_flags; >+ int fd, cl_flags, status; > unsigned int k_len, m_len; > int entry, ret; > >@@ -900,10 +935,17 @@ static int lookup_wild(struct autofs_poi > > mc = source->mc; > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > f = fopen(ctxt->mapname, "r"); > if (!f) { > error(ap->logopt, > MODPREFIX "could not open map file %s", ctxt->mapname); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return CHE_FAIL; > } > >@@ -914,6 +956,10 @@ static int lookup_wild(struct autofs_poi > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > while(1) { > entry = read_one(ap->logopt, f, mkey, &k_len, mapent, &m_len); > if (entry) { >diff -up autofs-5.0.1/daemon/indirect.c.fd-close-on-exec-mutex autofs-5.0.1/daemon/indirect.c >--- autofs-5.0.1/daemon/indirect.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/daemon/indirect.c 2007-12-03 18:48:59.000000000 +0900 >@@ -43,6 +43,8 @@ extern pthread_attr_t thread_attr; > static pthread_mutex_t ma_mutex = PTHREAD_MUTEX_INITIALIZER; > static pthread_mutex_t ea_mutex = PTHREAD_MUTEX_INITIALIZER; > >+extern pthread_mutex_t fd_mutex; >+ > static int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts) > { > struct mnt_list *this; >@@ -93,7 +95,7 @@ static int do_mount_autofs_indirect(stru > const char *type, *map_name = NULL; > struct stat st; > struct mnt_list *mnts; >- int cl_flags, ret; >+ int cl_flags, ret, status; > > mnts = get_mnt_list(_PROC_MOUNTS, ap->path, 1); > if (mnts) { >@@ -147,11 +149,18 @@ static int do_mount_autofs_indirect(stru > > options = NULL; > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Root directory for ioctl()'s */ > ap->ioctlfd = open(ap->path, O_RDONLY); > if (ap->ioctlfd < 0) { > crit(ap->logopt, > "failed to create ioctl fd for autofs path %s", ap->path); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > goto out_umount; > } > >@@ -160,6 +169,10 @@ static int do_mount_autofs_indirect(stru > fcntl(ap->ioctlfd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; > > ioctl(ap->ioctlfd, AUTOFS_IOC_SETTIMEOUT, &timeout); >diff -up autofs-5.0.1/daemon/spawn.c.fd-close-on-exec-mutex autofs-5.0.1/daemon/spawn.c >--- autofs-5.0.1/daemon/spawn.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/daemon/spawn.c 2007-12-03 18:48:59.000000000 +0900 >@@ -29,6 +29,7 @@ > > #include "automount.h" > >+pthread_mutex_t fd_mutex = PTHREAD_MUTEX_INITIALIZER; > static pthread_mutex_t spawn_mutex = PTHREAD_MUTEX_INITIALIZER; > > #define SPAWN_OPT_NONE 0x0000 >@@ -123,6 +124,10 @@ static int do_spawn(unsigned logopt, uns > egid = tsv->gid; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > f = fork(); > if (f == 0) { > reset_signals(); >@@ -131,6 +136,10 @@ static int do_spawn(unsigned logopt, uns > dup2(pipefd[1], STDERR_FILENO); > close(pipefd[1]); > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Bind mount - check target exists */ > if (use_access) { > char **pargv = (char **) argv; >@@ -166,6 +175,10 @@ static int do_spawn(unsigned logopt, uns > } else { > tmpsig = oldsig; > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > sigaddset(&tmpsig, SIGCHLD); > pthread_sigmask(SIG_SETMASK, &tmpsig, NULL); > >diff -up autofs-5.0.1/daemon/automount.c.fd-close-on-exec-mutex autofs-5.0.1/daemon/automount.c >--- autofs-5.0.1/daemon/automount.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/daemon/automount.c 2007-12-03 18:48:59.000000000 +0900 >@@ -81,6 +81,7 @@ static int umount_all(struct autofs_poin > > extern pthread_mutex_t master_mutex; > extern struct master *master_list; >+extern pthread_mutex_t fd_mutex; > > static int do_mkdir(const char *parent, const char *path, mode_t mode) > { >@@ -970,7 +971,7 @@ int do_expire(struct autofs_point *ap, c > > static int autofs_init_ap(struct autofs_point *ap) > { >- int pipefd[2], cl_flags; >+ int pipefd[2], cl_flags, status; > > if ((ap->state != ST_INIT)) { > /* This can happen if an autofs process is already running*/ >@@ -980,11 +981,18 @@ static int autofs_init_ap(struct autofs_ > > ap->pipefd = ap->kpipefd = ap->ioctlfd = -1; > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Pipe for kernel communications */ > if (pipe(pipefd) < 0) { > crit(ap->logopt, > "failed to create commumication pipe for autofs path %s", > ap->path); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return -1; > } > >@@ -1007,6 +1015,9 @@ static int autofs_init_ap(struct autofs_ > "failed create state pipe for autofs path %s", ap->path); > close(ap->pipefd); > close(ap->kpipefd); /* Close kernel pipe end */ >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return -1; > } > >@@ -1026,6 +1037,10 @@ static int autofs_init_ap(struct autofs_ > return 0; > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > return 0; > } > >diff -up autofs-5.0.1/daemon/direct.c.fd-close-on-exec-mutex autofs-5.0.1/daemon/direct.c >--- autofs-5.0.1/daemon/direct.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/daemon/direct.c 2007-12-03 18:48:59.000000000 +0900 >@@ -53,6 +53,8 @@ pthread_once_t key_mnt_params_once = PTH > static pthread_mutex_t ma_mutex = PTHREAD_MUTEX_INITIALIZER; > static pthread_mutex_t ea_mutex = PTHREAD_MUTEX_INITIALIZER; > >+extern pthread_mutex_t fd_mutex; >+ > static void key_mnt_params_destroy(void *arg) > { > struct mnt_params *mp; >@@ -107,7 +109,11 @@ int do_umount_autofs_direct(struct autof > } > ioctlfd = me->ioctlfd; > } else { >- int cl_flags; >+ int cl_flags, status; >+ >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); > > ioctlfd = open(me->key, O_RDONLY); > if (ioctlfd != -1) { >@@ -116,6 +122,10 @@ int do_umount_autofs_direct(struct autof > fcntl(ioctlfd, F_SETFD, cl_flags); > } > } >+ >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > } > > >@@ -309,11 +319,15 @@ int do_mount_autofs_direct(struct autofs > if (tree_get_mnt_list(mnts, &list, me->key, 1)) { > if (ap->state == ST_READMAP) { > time_t tout = ap->exp_timeout; >- int save_ioctlfd, ioctlfd; >+ int save_ioctlfd, ioctlfd, status; > > save_ioctlfd = ioctlfd = me->ioctlfd; > > if (ioctlfd == -1) { >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > ioctlfd = open(me->key, O_RDONLY); > if (ioctlfd != -1) { > cl_flags = fcntl(ioctlfd, F_GETFD, 0); >@@ -322,6 +336,11 @@ int do_mount_autofs_direct(struct autofs > fcntl(ioctlfd, F_SETFD, cl_flags); > } > } >+ >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > } > > if (ioctlfd < 0) { >@@ -402,10 +421,17 @@ int do_mount_autofs_direct(struct autofs > goto out_err; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Root directory for ioctl()'s */ > ioctlfd = open(me->key, O_RDONLY); > if (ioctlfd < 0) { > crit(ap->logopt, "failed to create ioctl fd for %s", me->key); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > goto out_umount; > } > >@@ -414,6 +440,10 @@ int do_mount_autofs_direct(struct autofs > fcntl(ioctlfd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Calculate the timeouts */ > ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO; > >@@ -548,6 +578,8 @@ int umount_autofs_offset(struct autofs_p > } > ioctlfd = me->ioctlfd; > } else { >+ int status; >+ > /* offset isn't mounted, return success and try to recover */ > if (!is_mounted(_PROC_MOUNTS, me->key, MNTS_AUTOFS)) { > debug(ap->logopt, >@@ -556,6 +588,10 @@ int umount_autofs_offset(struct autofs_p > return 0; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > ioctlfd = open(me->key, O_RDONLY); > if (ioctlfd != -1) { > if ((cl_flags = fcntl(ioctlfd, F_GETFD, 0)) != -1) { >@@ -563,6 +599,10 @@ int umount_autofs_offset(struct autofs_p > fcntl(ioctlfd, F_SETFD, cl_flags); > } > } >+ >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > } > > if (ioctlfd >= 0) { >@@ -760,10 +800,17 @@ int mount_autofs_offset(struct autofs_po > goto out_err; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > /* Root directory for ioctl()'s */ > ioctlfd = open(me->key, O_RDONLY); > if (ioctlfd < 0) { > crit(ap->logopt, "failed to create ioctl fd for %s", me->key); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > goto out_umount; > } > >@@ -772,6 +819,10 @@ int mount_autofs_offset(struct autofs_po > fcntl(ioctlfd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > ioctl(ioctlfd, AUTOFS_IOC_SETTIMEOUT, &timeout); > > ret = fstat(ioctlfd, &st); >@@ -1470,6 +1521,10 @@ int handle_packet_missing_direct(struct > return 1; > } > >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > if (me->ioctlfd != -1) { > /* Maybe someone did a manual umount, clean up ! */ > ioctlfd = me->ioctlfd; >@@ -1479,6 +1534,9 @@ int handle_packet_missing_direct(struct > > if (ioctlfd == -1) { > cache_unlock(mc); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > pthread_setcancelstate(state, NULL); > crit(ap->logopt, "failed to create ioctl fd for %s", me->key); > /* TODO: how do we clear wait q in kernel ?? */ >@@ -1490,6 +1548,10 @@ int handle_packet_missing_direct(struct > fcntl(ioctlfd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > debug(ap->logopt, "token %ld, name %s, request pid %u", > (unsigned long) pkt->wait_queue_token, me->key, pkt->pid); > >diff -up autofs-5.0.1/lib/nss_parse.y.fd-close-on-exec-mutex autofs-5.0.1/lib/nss_parse.y >--- autofs-5.0.1/lib/nss_parse.y.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/lib/nss_parse.y 2007-12-03 18:48:59.000000000 +0900 >@@ -33,6 +33,7 @@ > #include "nss_parse.tab.h" > > static pthread_mutex_t parse_mutex = PTHREAD_MUTEX_INITIALIZER; >+extern pthread_mutex_t fd_mutex; > > static struct list_head *nss_list; > static struct nss_source *src; >@@ -165,16 +166,24 @@ static void parse_close_nsswitch(void *a > int nsswitch_parse(struct list_head *list) > { > FILE *nsswitch; >- int fd, cl_flags, status; >+ int fd, cl_flags, status, cur_state; >+ >+ status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ >+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state); > > nsswitch = fopen(NSSWITCH_FILE, "r"); > if (!nsswitch) { > logerr("couldn't open %s\n", NSSWITCH_FILE); >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ pthread_setcancelstate(cur_state, NULL); > return 1; > } > >- pthread_cleanup_push(parse_close_nsswitch, nsswitch); >- > fd = fileno(nsswitch); > > if ((cl_flags = fcntl(fd, F_GETFD, 0)) != -1) { >@@ -182,9 +191,16 @@ int nsswitch_parse(struct list_head *lis > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > parse_mutex_lock(); >+ pthread_cleanup_push(parse_close_nsswitch, nsswitch); > pthread_cleanup_push(parse_mutex_unlock, NULL); > >+ pthread_setcancelstate(cur_state, NULL); >+ > nss_in = nsswitch; > > nss_automount_found = 0; >diff -up autofs-5.0.1/lib/rpc_subs.c.fd-close-on-exec-mutex autofs-5.0.1/lib/rpc_subs.c >--- autofs-5.0.1/lib/rpc_subs.c.fd-close-on-exec-mutex 2007-12-03 18:47:26.000000000 +0900 >+++ autofs-5.0.1/lib/rpc_subs.c 2007-12-03 18:48:59.000000000 +0900 >@@ -45,6 +45,8 @@ > #define MAX_IFC_BUF 1024 > #define MAX_ERR_BUF 128 > >+extern pthread_mutex_t fd_mutex; >+ > /* > * Create a UDP RPC client > */ >@@ -96,20 +98,31 @@ got_addr: > raddr.sin_port = htons(info->port); > > if (!info->client) { >+ int status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); > /* > * bind to any unused port. If we left this up to the rpc > * layer, it would bind to a reserved port, which has been shown > * to exhaust the reserved port range in some situations. > */ > fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); >- if (fd < 0) >+ if (fd < 0) { >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return NULL; >+ } > > if ((cl_flags = fcntl(fd, F_GETFD, 0)) != -1) { > cl_flags |= FD_CLOEXEC; > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > laddr.sin_family = AF_INET; > laddr.sin_port = 0; > laddr.sin_addr.s_addr = htonl(INADDR_ANY); >@@ -305,15 +318,27 @@ got_addr: > addr.sin_port = htons(info->port); > > if (!info->client) { >+ int status = pthread_mutex_lock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > fd = socket(PF_INET, SOCK_STREAM, info->proto->p_proto); >- if (fd < 0) >+ if (fd < 0) { >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); > return NULL; >+ } > > if ((cl_flags = fcntl(fd, F_GETFD, 0)) != -1) { > cl_flags |= FD_CLOEXEC; > fcntl(fd, F_SETFD, cl_flags); > } > >+ status = pthread_mutex_unlock(&fd_mutex); >+ if (status) >+ fatal(status); >+ > ret = connect_nb(fd, &addr, &info->timeout); > if (ret < 0) > goto out_close;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 233481
:
198661
| 275541