From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH 1/1] CLONE_PARENT shouldn't allow to set ->exit_signal Date: Sun, 18 Mar 2012 21:53:42 +0100 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> Reply-To: kernel-hardening@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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 To: Linus Torvalds Return-path: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Content-Disposition: inline In-Reply-To: List-Id: linux-fsdevel.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.