All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clone.2, execve.2: Document interaction of execve(2) with CLONE_FILES
@ 2013-05-06  6:14 Kevin Easton
       [not found] ` <20130506061441.GA9249-Qr0l8DEfScZEV+tojptmR0B+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Easton @ 2013-05-06  6:14 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hi Michael,

This patch is against man-pages-3.51.  It documents the fact that a
successful execve(2) in a process that is sharing a file descriptor table
results in unsharing the table.

I discovered this through testing and verified it by source inspection - 
there is a call to unshare_files() early in do_execve_common().

    - Kevin

diff -ur man-pages-3.51.orig/man2/clone.2 man-pages-3.51/man2/clone.2
--- man-pages-3.51.orig/man2/clone.2    2013-04-19 21:57:19.000000000 +1000
+++ man-pages-3.51/man2/clone.2 2013-05-06 15:42:06.841539649 +1000
@@ -206,6 +206,9 @@
 .BR fcntl (2)
 .B F_SETFD
 operation), the other process is also affected.
+If a process sharing a file descriptor table calls
+.BR execve (2),
+its file descriptor table is duplicated (unshared).

 If
 .B CLONE_FILES
Only in man-pages-3.51/man2: clone.2.orig
diff -ur man-pages-3.51.orig/man2/execve.2 man-pages-3.51/man2/execve.2
--- man-pages-3.51.orig/man2/execve.2   2013-04-19 21:57:19.000000000 +1000
+++ man-pages-3.51/man2/execve.2        2013-05-06 15:42:06.841539649 +1000
@@ -204,6 +204,11 @@
 .B SIGCHLD
 (see
 .BR clone (2)).
+.IP *
+The file descriptor table is unshared, undoing the effect of the
+.B CLONE_FILES
+flag of
+.BR clone (2).
 .PP
 Note the following further points:
 .IP * 3

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] clone.2, execve.2: Document interaction of execve(2) with CLONE_FILES
       [not found] ` <20130506061441.GA9249-Qr0l8DEfScZEV+tojptmR0B+6BGkLq7r@public.gmane.org>
@ 2015-02-05 12:40   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-02-05 12:40 UTC (permalink / raw)
  To: Kevin Easton
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA

On 05/06/2013 08:14 AM, Kevin Easton wrote:
> Hi Michael,
> 
> This patch is against man-pages-3.51.  It documents the fact that a
> successful execve(2) in a process that is sharing a file descriptor table
> results in unsharing the table.
> 
> I discovered this through testing and verified it by source inspection - 
> there is a call to unshare_files() early in do_execve_common().

Thanks, Kevin. Applied.

Cheers,

Michael


> diff -ur man-pages-3.51.orig/man2/clone.2 man-pages-3.51/man2/clone.2
> --- man-pages-3.51.orig/man2/clone.2    2013-04-19 21:57:19.000000000 +1000
> +++ man-pages-3.51/man2/clone.2 2013-05-06 15:42:06.841539649 +1000
> @@ -206,6 +206,9 @@
>  .BR fcntl (2)
>  .B F_SETFD
>  operation), the other process is also affected.
> +If a process sharing a file descriptor table calls
> +.BR execve (2),
> +its file descriptor table is duplicated (unshared).
> 
>  If
>  .B CLONE_FILES
> Only in man-pages-3.51/man2: clone.2.orig
> diff -ur man-pages-3.51.orig/man2/execve.2 man-pages-3.51/man2/execve.2
> --- man-pages-3.51.orig/man2/execve.2   2013-04-19 21:57:19.000000000 +1000
> +++ man-pages-3.51/man2/execve.2        2013-05-06 15:42:06.841539649 +1000
> @@ -204,6 +204,11 @@
>  .B SIGCHLD
>  (see
>  .BR clone (2)).
> +.IP *
> +The file descriptor table is unshared, undoing the effect of the
> +.B CLONE_FILES
> +flag of
> +.BR clone (2).
>  .PP
>  Note the following further points:
>  .IP * 3
> 
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-02-05 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06  6:14 [PATCH] clone.2, execve.2: Document interaction of execve(2) with CLONE_FILES Kevin Easton
     [not found] ` <20130506061441.GA9249-Qr0l8DEfScZEV+tojptmR0B+6BGkLq7r@public.gmane.org>
2015-02-05 12:40   ` Michael Kerrisk (man-pages)

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.