public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mq_open() and close_on_exec?
@ 2004-04-14  0:40 Chris Wright
  2004-04-14  4:47 ` Manfred Spraul
  2004-04-14  6:12 ` Jakub Jelinek
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Wright @ 2004-04-14  0:40 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: Andrew Morton, Ulrich Drepper, Linux Kernel

SUSv3 doesn't seem to specify one way or the other.  I don't have the
POSIX specs, and the old docs I have suggest that mq_open() creates an
object which is to be closed upon exec.  Anyone have a clue if this is
actually required?  Patch below sets this as default (if indeed it's
valid/required).

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

===== ipc/mqueue.c 1.6 vs edited =====
--- 1.6/ipc/mqueue.c	Mon Apr 12 10:54:17 2004
+++ edited/ipc/mqueue.c	Tue Apr 13 16:05:36 2004
@@ -641,6 +641,7 @@
 		goto out_putfd;
 	}
 
+	set_close_on_exec(fd, 1);
 	fd_install(fd, filp);
 	goto out_upsem;
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mq_open() and close_on_exec?
  2004-04-14  0:40 mq_open() and close_on_exec? Chris Wright
@ 2004-04-14  4:47 ` Manfred Spraul
  2004-04-14 16:49   ` Chris Wright
  2004-04-14  6:12 ` Jakub Jelinek
  1 sibling, 1 reply; 5+ messages in thread
From: Manfred Spraul @ 2004-04-14  4:47 UTC (permalink / raw)
  To: Chris Wright; +Cc: Andrew Morton, Ulrich Drepper, Linux Kernel

Chris Wright wrote:

>SUSv3 doesn't seem to specify one way or the other.  I don't have the
>POSIX specs, and the old docs I have suggest that mq_open() creates an
>object which is to be closed upon exec.  Anyone have a clue if this is
>actually required?  Patch below sets this as default (if indeed it's
>valid/required).
>  
>
Did you test what other unices do? I think the patch is correct - at 
least solaris implements message queues in user space, and then an exec 
should close everything.

--
    Manfred


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mq_open() and close_on_exec?
  2004-04-14  0:40 mq_open() and close_on_exec? Chris Wright
  2004-04-14  4:47 ` Manfred Spraul
@ 2004-04-14  6:12 ` Jakub Jelinek
  2004-04-14 16:53   ` Chris Wright
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2004-04-14  6:12 UTC (permalink / raw)
  To: Chris Wright; +Cc: Manfred Spraul, Andrew Morton, Ulrich Drepper, Linux Kernel

On Tue, Apr 13, 2004 at 05:40:05PM -0700, Chris Wright wrote:
> SUSv3 doesn't seem to specify one way or the other.  I don't have the
> POSIX specs, and the old docs I have suggest that mq_open() creates an
> object which is to be closed upon exec.  Anyone have a clue if this is
> actually required?  Patch below sets this as default (if indeed it's
> valid/required).

I think it is valid and required:
http://www.opengroup.org/onlinepubs/007904975/functions/exec.html

^[MSG] [Option Start] All open message queue descriptors in the calling process shall be closed, as described in
mq_close() . [Option End]

I'll add a new test for this into glibc testsuite.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mq_open() and close_on_exec?
  2004-04-14  4:47 ` Manfred Spraul
@ 2004-04-14 16:49   ` Chris Wright
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wright @ 2004-04-14 16:49 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: Chris Wright, Andrew Morton, Ulrich Drepper, Linux Kernel

* Manfred Spraul (manfred@colorfullife.com) wrote:
> Chris Wright wrote:
> >SUSv3 doesn't seem to specify one way or the other.  I don't have the
> >POSIX specs, and the old docs I have suggest that mq_open() creates an
> >object which is to be closed upon exec.  Anyone have a clue if this is
> >actually required?  Patch below sets this as default (if indeed it's
> >valid/required).
> >
> Did you test what other unices do? I think the patch is correct - at 
> least solaris implements message queues in user space, and then an exec 
> should close everything.

No, I haven't.  Looks like I missed the SUSv3 specification that indeed
requires closing on exec.  So, I believe the patch is needed.

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mq_open() and close_on_exec?
  2004-04-14  6:12 ` Jakub Jelinek
@ 2004-04-14 16:53   ` Chris Wright
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wright @ 2004-04-14 16:53 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Chris Wright, Manfred Spraul, Andrew Morton, Ulrich Drepper,
	Linux Kernel

* Jakub Jelinek (jakub@redhat.com) wrote:
> I think it is valid and required:
> http://www.opengroup.org/onlinepubs/007904975/functions/exec.html
> 
> ^[MSG] [Option Start] All open message queue descriptors in the calling process shall be closed, as described in
> mq_close() . [Option End]
> 
> I'll add a new test for this into glibc testsuite.

Thanks, I managed to miss that in the spec.

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-14 16:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-14  0:40 mq_open() and close_on_exec? Chris Wright
2004-04-14  4:47 ` Manfred Spraul
2004-04-14 16:49   ` Chris Wright
2004-04-14  6:12 ` Jakub Jelinek
2004-04-14 16:53   ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox