aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2020-11-12 14:07:17 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-11-12 14:07:17 +0100
commit52e5819c4190c3f248df4b976e0a04cc561289e4 (patch)
treef1f0977cd35785e6c0afdfda6018c9f7ac4d0cfc
parent1374ba427831cff322c7bcd8cabd3110b631b57e (diff)
downloadman-pages-52e5819c4190c3f248df4b976e0a04cc561289e4.tar.gz
clone.2, sigaltstack.2: clone(CLONE_VM) disdables the alternate signal stack
In the kernel sources (kernel/fork.c::copy_process()), we have: /* * sigaltstack should be cleared when sharing the same VM */ if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM) sas_ss_reset(p); Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man2/clone.29
-rw-r--r--man2/sigaltstack.28
2 files changed, 17 insertions, 0 deletions
diff --git a/man2/clone.2 b/man2/clone.2
index b013550b67..976738f7d8 100644
--- a/man2/clone.2
+++ b/man2/clone.2
@@ -1181,6 +1181,15 @@ space of the calling process at the time of the clone call.
Memory writes or file mappings/unmappings performed by one of the
processes do not affect the other, as with
.BR fork (2).
+.IP
+If the
+.BR CLONE_VM
+flag is specified and the
+.BR CLONE_VM
+flag is not specified,
+then any alternate signal stack that was established by
+.BR sigaltstack (2)
+is cleared in the child process.
.SH RETURN VALUE
.\" gettid(2) returns current->pid;
.\" getpid(2) returns current->tgid;
diff --git a/man2/sigaltstack.2 b/man2/sigaltstack.2
index d6eaea830f..aada8ff693 100644
--- a/man2/sigaltstack.2
+++ b/man2/sigaltstack.2
@@ -269,6 +269,14 @@ signal stack.
A child process created via
.BR fork (2)
inherits a copy of its parent's alternate signal stack settings.
+The same is also true for a child process created using
+.BR clone (2),
+unless the clone flags include
+.BR CLONE_VM
+and do not include
+.BR CLONE_VFORK ,
+in which case any alternate signal stack that was established in the parent
+is disabled in the child process.
.PP
.BR sigaltstack ()
supersedes the older