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-next>] [day] [month] [year] [list]
Message-ID: <20090225190211.GA7445@redhat.com>
Date:	Wed, 25 Feb 2009 20:02:11 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Alan Cox <alan@...rguk.ukuu.org.uk>,
	Chris Evans <scarybeasts@...il.com>,
	David Howells <dhowells@...hat.com>,
	Don Howard <dhoward@...hat.com>,
	Eugene Teo <eugene@...hat.com>,
	Michael Kerrisk <mtk.manpages@...glemail.com>,
	Roland McGrath <roland@...hat.com>,
	Tavis Ormandy <taviso@....lonestar.org>,
	Vitaly Mayatskikh <vmayatsk@...hat.com>, stable@...nel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] copy_process: fix CLONE_PARENT && ->exit_signal
	interaction

clone(CLONE_PARENT | SIGXXX) blindly sets ->exit_signal = SIGXXX. It is not
clear to me what was the supposed behaviour but this does not look right.
The parent of the forking task will receive this signal which bypasses all
security checks.

With this patch CLONE_PARENT re-uses both ->real_parent and ->exit_signal,
this looks at least logical.

Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Reported-by: Chris Evans <scarybeasts@...il.com>

--- 6.29-rc3/kernel/fork.c~1_EXIT_SIGNAL	2009-02-09 01:03:48.000000000 +0100
+++ 6.29-rc3/kernel/fork.c	2009-02-25 18:09:56.000000000 +0100
@@ -1217,10 +1217,16 @@ static struct task_struct *copy_process(
 			!cpu_online(task_cpu(p))))
 		set_task_cpu(p, smp_processor_id());
 
-	/* CLONE_PARENT re-uses the old parent */
-	if (clone_flags & (CLONE_PARENT|CLONE_THREAD))
+	/* CLONE_PARENT re-uses the old parent and exit_signal */
+	if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
+		/*
+		 * Do this under tasklist_lock to avoid the race with
+		 * re-parenting to init.
+		 */
+		if (!(clone_flags & CLONE_THREAD))
+			p->exit_signal = current->group_leader->exit_signal;
 		p->real_parent = current->real_parent;
-	else
+	} else
 		p->real_parent = current;
 
 	spin_lock(&current->sighand->siglock);

--
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