Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758780AbZJELNv (ORCPT ); Mon, 5 Oct 2009 07:13:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758727AbZJELNu (ORCPT ); Mon, 5 Oct 2009 07:13:50 -0400 Received: from viefep19-int.chello.at ([62.179.121.39]:3613 "EHLO viefep19-int.chello.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753527AbZJELNu (ORCPT ); Mon, 5 Oct 2009 07:13:50 -0400 X-SourceIP: 213.93.53.227 Subject: Re: futex question From: Peter Zijlstra To: Thomas Gleixner Cc: Anirban Sinha , Ingo Molnar , linux-kernel@vger.kernel.org, Darren Hart , Kaz Kylheku , Anirban Sinha In-Reply-To: References: <20091001092218.GH15345@elte.hu> <4AC68F13.8050601@us.ibm.com> <4AC8CF32.8060108@anirban.org> <1254738974.26976.24.camel@twins> Content-Type: text/plain Date: Mon, 05 Oct 2009 13:16:12 +0200 Message-Id: <1254741372.26976.35.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 52 On Mon, 2009-10-05 at 12:56 +0200, Thomas Gleixner wrote: > > Looking more into that I think we should check whether the robust list > has an entry (lock held) in do_execve() and return -EWOULDBLOCK to > luser space. Same if pi_waiters is not empty. Holding a lock and > calling execve() is simply broken. Fine by me ;-) something like the below? The question is of course what Ani was doing that triggered this in the first place and if he can live with this.. :-) --- fs/exec.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) 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 + retval = unshare_files(&displaced); if (retval) goto out_ret; -- 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/