From: Davide Libenzi on 31 May 2007 16:30 On Thu, 31 May 2007, Ulrich Drepper wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Davide Libenzi wrote: > > What I meant, was that the vast majority of MT+exec > > apps wants all their fds (but an handfull, maybe) > > You never listen when you are told something. Such a statement cannot > be made. The application doesn't know what the runtime libraries need > (not just libc, libstdc++, libxml, whatever) and vice versa. Policies > are always wrong for somebody and changing the standardized behavior is > not acceptable. I do always listen when you make a good point. And this is a good one. Some libraries might not like a global behaviour change, I agree. - Davide - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on 31 May 2007 19:30 On Thu, 31 May 2007 14:09:15 -0400 Ulrich Drepper <drepper(a)redhat.com> wrote: > I've brought this topic up before but didn't provide a patch. Well, here > we go again, this time with a patch. I even throw in a test program. > > The problem is as follows: in multi-threaded code (or more correctly: all > code using clone() with CLONE_FILES) we have a race when exec'ing. > > thread #1 thread #2 > > fd=open() > > fork + exec > > fcntl(fd,F_SETFD,FD_CLOEXEC) > > In some applications this can happen frequently. Take a web browser. One > thread opens a file and another thread starts, say, an external PDF viewer. > The result can even be a security issue if that open file descriptor refers > to a sensitive file and the external program can somehow be tricked into > using that descriptor. > > Just adding O_CLOEXEC support to open() doesn't solve the whole set of > problems. There are other ways to create file descriptors (socket, > epoll_create, Unix domain socket transfer, etc). These can and should > be addressed separately though. open() is such an easy case that it makes > not much sense putting the fix off. > > ... > > diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h > index c154b9d..b847741 100644 > --- a/include/asm-generic/fcntl.h > +++ b/include/asm-generic/fcntl.h > @@ -48,6 +48,9 @@ > #ifndef O_NOATIME > #define O_NOATIME 01000000 > #endif > +#ifndef O_CLOEXEC > +#define O_CLOEXEC 02000000 /* set close_on_exec */ > +#endif > #ifndef O_NDELAY > #define O_NDELAY O_NONBLOCK > #endif This will break xtensa, because that architecture (and only that architecture) doesn't include asm-generic/fcntl.h from asm/fcntl.h. But let's leave this patch as-is: it's xtensa which needs fixing. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Stephen Rothwell on 31 May 2007 21:10 On Thu, 31 May 2007 16:20:21 -0700 Andrew Morton <akpm(a)linux-foundation.org> wrote: > > This will break xtensa, because that architecture (and only that > architecture) doesn't include asm-generic/fcntl.h from asm/fcntl.h. It used to (for a whole 15 months). Consolidation and cleanup is hard enough to do once ... > But let's leave this patch as-is: it's xtensa which needs fixing. See my other patch ... -- Cheers, Stephen Rothwell sfr(a)canb.auug.org.au http://www.canb.auug.org.au/~sfr/
From: Stephen Rothwell on 31 May 2007 21:40 On Thu, 31 May 2007 16:20:21 -0700 Andrew Morton <akpm(a)linux-foundation.org> wrote: > > > diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h > > index c154b9d..b847741 100644 > > --- a/include/asm-generic/fcntl.h > > +++ b/include/asm-generic/fcntl.h > > @@ -48,6 +48,9 @@ > > #ifndef O_NOATIME > > #define O_NOATIME 01000000 > > #endif > > +#ifndef O_CLOEXEC > > +#define O_CLOEXEC 02000000 /* set close_on_exec */ > > +#endif > > #ifndef O_NDELAY > > #define O_NDELAY O_NONBLOCK > > #endif > > This will break xtensa, because that architecture (and only that > architecture) doesn't include asm-generic/fcntl.h from asm/fcntl.h. This also breaks Alpha (which uses 02000000 for O_DIRECT) and parisc (which uses 02000000 for O_RSYNC). So you ether need to choose a different value or define O_CLOEXEC for those two architectures. -- Cheers, Stephen Rothwell sfr(a)canb.auug.org.au http://www.canb.auug.org.au/~sfr/
From: Kyle McMartin on 31 May 2007 23:10 On Fri, Jun 01, 2007 at 11:38:40AM +1000, Stephen Rothwell wrote: > This also breaks Alpha (which uses 02000000 for O_DIRECT) and parisc > (which uses 02000000 for O_RSYNC). So you ether need to choose a > different value or define O_CLOEXEC for those two architectures. > That's easy enough to fix... Signed-off-by: Kyle McMartin <kyle(a)parisc-linux.org> diff --git a/include/asm-parisc/fcntl.h b/include/asm-parisc/fcntl.h index 317851f..4ca0fb0 100644 --- a/include/asm-parisc/fcntl.h +++ b/include/asm-parisc/fcntl.h @@ -14,6 +14,7 @@ #define O_DSYNC 01000000 /* HPUX only */ #define O_RSYNC 02000000 /* HPUX only */ #define O_NOATIME 04000000 +#define O_CLOEXEC 08000000 /* set close_on_exec */ #define O_DIRECTORY 00010000 /* must be a directory */ #define O_NOFOLLOW 00000200 /* don't follow links */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: CFS scheduler, -v8 Next: [patch 06/10] Immediate Value - i386 Optimization |