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:	Mon, 4 Jun 2012 18:15:16 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Filipe Brandenburger <filbranden@...il.com>
Cc:	Tejun Heo <tj@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Rientjes <rientjes@...gle.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] prctl: pdeath_signal sent when parent thread
	(instead of parent process) dies

Hi Filipe,

On 06/01, Filipe Brandenburger wrote:
>
> On Fri, Jun 1, 2012 at 3:02 PM, Oleg Nesterov <oleg@...hat.com> wrote:
> > Filipe, you can't even imagine how much do I like this change
> > personally ;) Although I think that pdeath_signal code should
> > be moved into reparent_leader(). I suggested this many times.
>
> Yes, that would really make sense!

Forgot to mention, and we should make ->pdeath_signal per-process.

> > But I was told there are users which depend on current behaviour,
> > they really want to know when the parent _thread_ exits.
>
> Hmmm... but is it the parent thread inside the same process or the
> thread of the parent process that forked it?

It is the parent thread inside the same process which forked the
child initially. Assuming you are asking about the exiting "father"
thread.

> doesn't really make any
> sense to me...

Same here ;) that is why I tried to change this logic too.

Parent/child relationship is process-wide. task->parent points to
the thread, but this is just the technical detail and it is only
needed because we have __WNOTHREAD (see do_wait).

IOW. I think we should move ->pdeath_signal from task_struct to
signal_struct, and then do

	--- x/kernel/exit.c
	+++ x/kernel/exit.c
	@@ -770,6 +770,9 @@ static void reparent_leader(struct task_
		if (same_thread_group(p->real_parent, father))
			return;
	 
	+	if (p->signal->pdeath_signal)
	+		group_send_sig_info(p->signal->pdeath_signal, SEND_SIG_NOINFO, p);
	+
		/* We don't want people slaying init.  */
		p->exit_signal = SIGCHLD;
	 
	@@ -806,9 +809,6 @@ static void forget_original_parent(struc
					BUG_ON(t->ptrace);
					t->parent = t->real_parent;
				}
	-			if (t->pdeath_signal)
	-				group_send_sig_info(t->pdeath_signal,
	-						    SEND_SIG_NOINFO, t);
			} while_each_thread(p, t);
			reparent_leader(father, p, &dead_children);
		}

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