From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756813Ab2CRVCK (ORCPT ); Sun, 18 Mar 2012 17:02:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18478 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752415Ab2CRVCH (ORCPT ); Sun, 18 Mar 2012 17:02:07 -0400 Date: Sun, 18 Mar 2012 21:53:42 +0100 From: Oleg Nesterov To: Linus Torvalds Cc: Andrew Morton , Djalal Harouni , Alan Cox , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Al Viro , Alexey Dobriyan , "Eric W. Biederman" , Vasiliy Kulikov , Kees Cook , Solar Designer , WANG Cong , James Morris , linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, Greg KH , Ingo Molnar , Stephen Wilson , "Jason A. Donenfeld" , Roland McGrath Subject: Re: [PATCH 1/1] CLONE_PARENT shouldn't allow to set ->exit_signal Message-ID: <20120318205342.GA14383@redhat.com> References: <1331421919-15499-1-git-send-email-tixxdz@opendz.org> <1331421919-15499-2-git-send-email-tixxdz@opendz.org> <20120311172512.GA2729@redhat.com> <20120311174953.GB2729@redhat.com> <20120314185510.GA14172@redhat.com> <20120314185538.GB14172@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/18, Linus Torvalds wrote: > > On Wed, Mar 14, 2012 at 11:55 AM, Oleg Nesterov wrote: > > +       if (clone_flags & CLONE_THREAD) > > +               p->exit_signal = -1; > > +       else if (clone_flags & CLONE_PARENT) > > +               p->exit_signal = current->group_leader->exit_signal; > > +       else > > +               p->exit_signal = (clone_flags & CSIGNAL); > > So why is it "current->group_leader->exit_signal" rather than the much > more logical (imho) and simpler "current->exit_signal"? This would be wrong if current is not the main thread. In this case current->exit_signal = -1. Only group_leader has the "real" exit_signal used for notification. Historically "exit_signal = -1" meant different things, currently it only means "I am not the leader", see thread_group_leader(). I'll write another email tomorrow. Yes, I do remember I promised the security fixes in this area, sorry for delay. Oleg.