* Fix file descriptor leak
@ 2006-03-29 20:33 Daniel J Walsh
2006-03-30 17:00 ` Stephen Smalley
0 siblings, 1 reply; 4+ messages in thread
From: Daniel J Walsh @ 2006-03-29 20:33 UTC (permalink / raw)
To: Stephen Smalley, SE Linux
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: libsemanage-rhat.patch --]
[-- Type: text/x-patch, Size: 484 bytes --]
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-1.6.2/src/semanage_store.c
--- nsalibsemanage/src/semanage_store.c 2006-03-10 09:48:01.000000000 -0500
+++ libsemanage-1.6.2/src/semanage_store.c 2006-03-29 14:20:16.000000000 -0500
@@ -1159,6 +1159,8 @@
ERR(sh, "Could not open direct %s at %s.", lock_name, lock_file);
return -1;
}
+ fcntl(fd, FD_CLOEXEC, 0);
+
if (sh->timeout == 0) {
/* return immediately */
origtime.tv_sec = 0;
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Fix file descriptor leak 2006-03-29 20:33 Fix file descriptor leak Daniel J Walsh @ 2006-03-30 17:00 ` Stephen Smalley 2006-03-30 18:46 ` Daniel J Walsh 0 siblings, 1 reply; 4+ messages in thread From: Stephen Smalley @ 2006-03-30 17:00 UTC (permalink / raw) To: Daniel J Walsh; +Cc: James Morris, SE Linux On Wed, 2006-03-29 at 15:33 -0500, Daniel J Walsh wrote: diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-1.6.2/src/semanage_store.c --- nsalibsemanage/src/semanage_store.c 2006-03-10 09:48:01.000000000 -0500 +++ libsemanage-1.6.2/src/semanage_store.c 2006-03-29 14:20:16.000000000 -0500 @@ -1159,6 +1159,8 @@ ERR(sh, "Could not open direct %s at %s.", lock_name, lock_file); return -1; } + fcntl(fd, FD_CLOEXEC, 0); + if (sh->timeout == 0) { /* return immediately */ origtime.tv_sec = 0; Shouldn't that be: fcntl(fd, F_SETFD, FD_CLOEXEC)? -- Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix file descriptor leak 2006-03-30 17:00 ` Stephen Smalley @ 2006-03-30 18:46 ` Daniel J Walsh 2006-03-30 19:50 ` Stephen Smalley 0 siblings, 1 reply; 4+ messages in thread From: Daniel J Walsh @ 2006-03-30 18:46 UTC (permalink / raw) To: sds; +Cc: James Morris, SE Linux Stephen Smalley wrote: > On Wed, 2006-03-29 at 15:33 -0500, Daniel J Walsh wrote: > diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-1.6.2/src/semanage_store.c > --- nsalibsemanage/src/semanage_store.c 2006-03-10 09:48:01.000000000 -0500 > +++ libsemanage-1.6.2/src/semanage_store.c 2006-03-29 14:20:16.000000000 -0500 > @@ -1159,6 +1159,8 @@ > ERR(sh, "Could not open direct %s at %s.", lock_name, lock_file); > return -1; > } > + fcntl(fd, FD_CLOEXEC, 0); > + > if (sh->timeout == 0) { > /* return immediately */ > origtime.tv_sec = 0; > > Shouldn't that be: > fcntl(fd, F_SETFD, FD_CLOEXEC)? > > yes -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix file descriptor leak 2006-03-30 18:46 ` Daniel J Walsh @ 2006-03-30 19:50 ` Stephen Smalley 0 siblings, 0 replies; 4+ messages in thread From: Stephen Smalley @ 2006-03-30 19:50 UTC (permalink / raw) To: Daniel J Walsh; +Cc: James Morris, SE Linux On Thu, 2006-03-30 at 13:46 -0500, Daniel J Walsh wrote: > Stephen Smalley wrote: > > On Wed, 2006-03-29 at 15:33 -0500, Daniel J Walsh wrote: > > diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-1.6.2/src/semanage_store.c > > --- nsalibsemanage/src/semanage_store.c 2006-03-10 09:48:01.000000000 -0500 > > +++ libsemanage-1.6.2/src/semanage_store.c 2006-03-29 14:20:16.000000000 -0500 > > @@ -1159,6 +1159,8 @@ > > ERR(sh, "Could not open direct %s at %s.", lock_name, lock_file); > > return -1; > > } > > + fcntl(fd, FD_CLOEXEC, 0); > > + > > if (sh->timeout == 0) { > > /* return immediately */ > > origtime.tv_sec = 0; > > > > Shouldn't that be: > > fcntl(fd, F_SETFD, FD_CLOEXEC)? > > > > > yes Ok, merged the following internally. Waiting for sourceforge to come back. Index: libsemanage/src/semanage_store.c =================================================================== RCS file: /nfshome/pal/CVS/selinux-usr/libsemanage/src/semanage_store.c,v retrieving revision 1.44 diff -u -p -r1.44 semanage_store.c --- libsemanage/src/semanage_store.c 8 Mar 2006 16:42:21 -0000 1.44 +++ libsemanage/src/semanage_store.c 30 Mar 2006 19:26:50 -0000 @@ -1159,6 +1159,12 @@ static int semanage_get_lock(semanage_ha ERR(sh, "Could not open direct %s at %s.", lock_name, lock_file); return -1; } + if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { + ERR(sh, "Could not set close-on-exec for %s at %s.", lock_name, lock_file); + close(fd); + return -1; + } + if (sh->timeout == 0) { /* return immediately */ origtime.tv_sec = 0; -- Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-30 19:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-03-29 20:33 Fix file descriptor leak Daniel J Walsh 2006-03-30 17:00 ` Stephen Smalley 2006-03-30 18:46 ` Daniel J Walsh 2006-03-30 19:50 ` Stephen Smalley
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.