From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758791AbZJELU2 (ORCPT ); Mon, 5 Oct 2009 07:20:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758736AbZJELU2 (ORCPT ); Mon, 5 Oct 2009 07:20:28 -0400 Received: from mx2.mail.elte.hu ([157.181.151.9]:44964 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756333AbZJELU1 (ORCPT ); Mon, 5 Oct 2009 07:20:27 -0400 Date: Mon, 5 Oct 2009 13:19:33 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: Thomas Gleixner , Anirban Sinha , linux-kernel@vger.kernel.org, Darren Hart , Kaz Kylheku , Anirban Sinha Subject: Re: futex question Message-ID: <20091005111933.GA25889@elte.hu> References: <20091001092218.GH15345@elte.hu> <4AC68F13.8050601@us.ibm.com> <4AC8CF32.8060108@anirban.org> <1254738974.26976.24.camel@twins> <1254741372.26976.35.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1254741372.26976.35.camel@twins> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.5 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Zijlstra wrote: > diff --git a/fs/exec.c b/fs/exec.c > index d49be6b..0812ba6 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1295,6 +1295,22 @@ int do_execve(char * filename, > bool clear_in_exec; > int retval; > > + retval = -EWOULDBLOCK; > +#ifdef CONFIG_FUTEX > + if (unlikely(current->robust_list)) > + goto out_ret; > +#ifdef CONFIG_COMPAT > + if (unlikely(current->compat_robust_list)) > + goto out_ret; > +#endif > + spin_lock_irq(¤t->pi_lock); > + if (!list_empty(¤t->pi_state_list)) { > + spin_unlock_irq(¤t->pi_lock); > + goto out_ret; > + } > + spin_unlock_irq(¤t->pi_lock); > +#endif i suspect this should have the form of: retval = can_exec_robust_futexes(); if (retval) goto out_ret retval = unshare_files(&displaced); if (retval) goto out_ret; ... but ... shouldnt we just do what exec normally does and zap any state that shouldnt be carried over into the new context - instead of denying the exec? Am i missing something? Ingo