From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbcF0I23 (ORCPT ); Mon, 27 Jun 2016 04:28:29 -0400 Received: from merlin.infradead.org ([205.233.59.134]:53002 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbcF0I22 (ORCPT ); Mon, 27 Jun 2016 04:28:28 -0400 Date: Mon, 27 Jun 2016 10:28:23 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Linus Torvalds , Oleg Nesterov , Tejun Heo , LKP , LKML , kernel test robot Subject: Re: kthread_stop insanity (Re: [[DEBUG] force] 2642458962: BUG: unable to handle kernel paging request at ffffc90000997f18) Message-ID: <20160627082823.GW30154@twins.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 26, 2016 at 10:22:32PM -0700, Andy Lutomirski wrote: > kthread_stop is *sick*. > > struct kthread self; > > ... > > current->vfork_done = &self.exited; > > ... > > do_exit(ret); > > And then some other thread goes and waits for the completion, which is > *on the stack*, which, in any sane world (e.g. with my series > applied), is long gone by then. cute > Is there seriously no way to directly wait for a struct task_struct to > exit? Could we, say, kmalloc the completion (or maybe even the whole > struct kthread) I suppose the easiest is to merge struct kthread into struct kthread_create_info, and maybe union some bits if we're really worried about size. > and (ick!) hang it off ->vfork_done? This... cleanup is going to be somewhat icky.