mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Oleg Nesterov <oleg@redhat.com>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Michal Hocko <mhocko@suse.com>,
	Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>,
	Mateusz Guzik <mguzik@redhat.com>,
	linux-kernel@vger.kernel.org,
	Pavel Emelyanov <xemul@virtuozzo.com>,
	Konstantin Khorenko <khorenko@virtuozzo.com>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Lennart Poettering <lennart@poettering.net>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Kay Sievers <kay.sievers@vrfy.org>
Subject: [PATCH] prctl.2: Document new PR_SET_CHILD_SUBREAPER semantics
Date: Fri, 27 Jan 2017 13:11:25 +0300	[thread overview]
Message-ID: <20170127101125.18709-1-ptikhomirov@virtuozzo.com> (raw)
In-Reply-To: <20170127100543.18390-1-ptikhomirov@virtuozzo.com>

old semantics was non deterministic and worked differently
depending on the external factors, but nothing changes if
process first sets itself subreaper and only after forks

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 man2/prctl.2 | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/man2/prctl.2 b/man2/prctl.2
index 97cf21a..84fbd7e 100644
--- a/man2/prctl.2
+++ b/man2/prctl.2
@@ -162,20 +162,30 @@ if
 is zero, unset the attribute.
 
 When a process is marked as a child subreaper,
-all of the children that it creates, and their descendants,
+all of the children that it creates or have created already, and their descendants,
 will be marked as having a subreaper.
 In effect, a subreaper fulfills the role of
 .BR init (1)
 for its descendant processes.
-Upon termination of a process
-that is orphaned (i.e., its immediate parent has already terminated)
-and marked as having a subreaper,
-the nearest still living ancestor subreaper
-will receive a
+Upon termination of a process having a subreaper,
+all its children become orphaned
+and will be reparented to the nearest still living ancestor subreaper.
+So that on it's adopted child termination
+these subreaper will receive a
 .BR SIGCHLD
 signal and will be able to
 .BR wait (2)
-on the process to discover its termination status.
+on the child to discover its termination status.
+
+Note, that on older kernels these prctl works slightly different.
+Child subreaper process was not actualy the
+.BR init (1)
+for all its descendants.
+If process forks a child while not been a child subreaper,
+and after sets himself child subreaper,
+sub-tree of the child might or might not reparent to the subreaper,
+depending on the configuration of ancestors of the subreaper,
+at the time of forking our subtree.
 .TP
 .BR PR_GET_CHILD_SUBREAPER " (since Linux 3.4)"
 Return the "child subreaper" setting of the caller,
-- 
2.9.3

  parent reply	other threads:[~2017-01-27 10:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 10:05 [PATCH v2 0/2] prctl: make PR_SET_CHILD_SUBREAPER deterministic Pavel Tikhomirov
2017-01-27 10:05 ` [PATCH 1/2] introduce the walk_process_tree() helper Pavel Tikhomirov
2017-01-27 10:05 ` [PATCH v2 2/2] prctl: propagate has_child_subreaper flag to every descendant Pavel Tikhomirov
2017-01-30 12:51   ` Oleg Nesterov
2017-01-30 13:15     ` Pavel Tikhomirov
2017-01-30 14:01       ` Oleg Nesterov
2017-01-27 10:11 ` Pavel Tikhomirov [this message]
2017-01-27 22:47   ` [PATCH] prctl.2: Document new PR_SET_CHILD_SUBREAPER semantics Michael Kerrisk (man-pages)
2017-01-28  6:38     ` Pavel Tikhomirov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170127101125.18709-1-ptikhomirov@virtuozzo.com \
    --to=ptikhomirov@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=gorcunov@openvz.org \
    --cc=john.stultz@linaro.org \
    --cc=kay.sievers@vrfy.org \
    --cc=khorenko@virtuozzo.com \
    --cc=lennart@poettering.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mguzik@redhat.com \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=mtk.manpages@gmail.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=skinsbursky@virtuozzo.com \
    --cc=tglx@linutronix.de \
    --cc=xemul@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®