Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751440AbWCMPab (ORCPT ); Mon, 13 Mar 2006 10:30:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751443AbWCMPaa (ORCPT ); Mon, 13 Mar 2006 10:30:30 -0500 Received: from mx1.redhat.com ([66.187.233.31]:427 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S1751440AbWCMPaa (ORCPT ); Mon, 13 Mar 2006 10:30:30 -0500 Date: Mon, 13 Mar 2006 10:30:22 -0500 From: Jakub Jelinek To: Ulrich Drepper Cc: GOTO Masanori , akpm@osdl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Fix sigaltstack corruption among cloned threads Message-ID: <20060313153022.GP20301@devserv.devel.redhat.com> Reply-To: Jakub Jelinek References: <81ek16loay.wl%gotom@sanori.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1282 Lines: 30 On Mon, Mar 13, 2006 at 07:16:17AM -0800, Ulrich Drepper wrote: > On 3/13/06, GOTO Masanori wrote: > > + * sigaltstack should be cleared when CLONE_SIGHAND (and CLONE_VM) is > > + * specified. > > + */ > > + if (clone_flags & CLONE_SIGHAND) > > + p->sas_ss_sp = p->sas_ss_size = 0; > > I agree in general, but why base it on CLONE_SIGHAND? The problem > results from using the same address space. So it should be > > if (clone_flags & CLONE_VM) > > The fact that both these flags are used at the same time in all cases > today shouldn't hide the real reason for this requirement which is > sharing the address space. Because vfork also sets CLONE_VM and vfork isn't supposed to reset alternate stack setting. For vfork that's not a problem, as the parent task will not continue until the vfork child execve's. So, if you want to use CLONE_VM bit, you'd need to use if ((clone_flags & (CLONE_VM | CLONE_VFORK)) == CLONE_VM) p->sas_ss_sp = p->sas_ss_size = 0; Jakub - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/