mq_open() and close_on_exec?
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
Signature · 12 lines
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;
Quoted 7 lines · Chris Wright
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
Quoted 10 lines · * Manfred Spraul ([email protected]) wrote:
Quoted 6 lines · Chris Wright
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
Signature · 1 line
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
Quoted 5 lines · Chris Wright
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
Quoted 7 lines · * Jakub Jelinek ([email protected]) 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
Signature · 1 line
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net