Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 20 Feb 2003 16:51:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 20 Feb 2003 16:51:15 -0500 Received: from mx1.elte.hu ([157.181.1.137]:61096 "HELO mx1.elte.hu") by vger.kernel.org with SMTP id ; Thu, 20 Feb 2003 16:51:08 -0500 Date: Thu, 20 Feb 2003 23:00:20 +0100 (CET) From: Ingo Molnar Reply-To: Ingo Molnar To: Linus Torvalds Cc: Zwane Mwaikambo , Chris Wedgwood , Kernel Mailing List , "Martin J. Bligh" , William Lee Irwin III Subject: Re: doublefault debugging (was Re: Linux v2.5.62 --- spontaneous reboots) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1579 Lines: 44 On Thu, 20 Feb 2003, Linus Torvalds wrote: > > ie. something like: > > Well, please remove the double test for task inequality. ok. > I like the patch conceptually, HOWEVER, I'm not sure it's correct. The > thing is, moving the wait_task_inactive() to __put_task_struct() means > that we will be doing the "release_task()" teardown while the task is > still potentially active on another CPU. > > In particular, we'll be freeing the security stuff and the signals while > the process may still be active in the scheduler on another CPU. This > can be dangerous, ie doing things like calling "free_uid()" on a process > that is still running means that suddenly you have issues like not being > able to trust "current->user" from interrupts. We may not care right > now, but it's still wrong (imagine us doing per-user time accounting - > which makes a _lot_ of sense). well, we can do the wait_task_inactive() in both cases - in release_task(), and in __put_task_struct(). [in the release_task() path that will just be a nop]. This further simplifies the patch. Ingo --- kernel/fork.c.orig +++ kernel/fork.c @@ -75,6 +75,7 @@ void __put_task_struct(struct task_struct *tsk) { if (tsk != current) { + wait_task_inactive(tsk); free_thread_info(tsk->thread_info); kmem_cache_free(task_struct_cachep,tsk); } else { - 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/