lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 19 Aug 2011 15:13:39 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Kay Sievers <kay.sievers@...y.org>
Cc:	Lennart Poettering <mzxreary@...inter.de>,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	linux-man@...r.kernel.org, roland@...k.frob.com,
	torvalds@...ux-foundation.org
Subject: Re: +
	prctl-add-pr_setget_child_reaper-to-allow-simple-process-supervision
	.patch added to -mm tree

On 08/19, Kay Sievers wrote:
>
> On Fri, Aug 19, 2011 at 14:25, Oleg Nesterov <oleg@...hat.com> wrote:
>
> >> +             case PR_SET_CHILD_SUBREAPER:
> >> +                     me->signal->is_child_subreaper = !!arg2;
> >> +                     me->signal->has_child_subreaper = true;
> >
> > Hmm. This looks wrong... why do we set ->has_child_subreaper?
>
> That's the flag we pass down to our childs, hence we need to set it here.

Aha, I see. I've misread copy_signal(), it copies ->has_child_subreaper,
_not_ ->is_child_subreaper (as I wrongly thought) from parent. And I was
going to blame this logic in the next email, I already started to write it ;)

But this has other (OK, minor) problems too, afaics. First of all, this
->has_child_subreaper = T is not right when the caller exits. We should
not look for ->is_child_subreaper parent, our children should to find us.

Right?

And. afaics this makes the semantics of prctl(REAPER) a bit unclear...
Suppose a task P does

	C1 = fork();

	prctl(REAPER);

	C2 = fork();

In this case it "owns" the children of C2, but not C1. This is fine, and
perhaps this is even better.

But what if P->parent did prctl(REAPER) too? Then P becomes the sub-reaper
for the tasks which were forked before prctl().

In short, in general the caller of prctl(REAPER) doesn't know how this
can affect the forks in the past.

Again, again, I am not arguing. Just I think we should discuss everything
if we are going to add the new feature.



Finally. I am not sure this is really better, but it seems we can
can ->has_child_subreape "more correct" with the same effect.

	- prctl(PR_SET_CHILD_SUBREAPER):

		me->is_child_subreaper = !!arg2;
		// ->has_child_subreaper is not set

	- copy_signal():

		me->has_child_subreaper =
			parent->has_child_subreaper ||
			parent->is_child_subreaper;

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ