From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753644AbcLHVAt (ORCPT ); Thu, 8 Dec 2016 16:00:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:57093 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbcLHVAr (ORCPT ); Thu, 8 Dec 2016 16:00:47 -0500 Date: Thu, 8 Dec 2016 22:00:40 +0100 From: "Luis R. Rodriguez" To: Kees Cook Cc: "Luis R. Rodriguez" , shuah@kernel.org, Jessica Yu , Rusty Russell , "Eric W. Biederman" , Dmitry Torokhov , Arnaldo Carvalho de Melo , Jonathan Corbet , martin.wilck@suse.com, Michal Marek , Petr Mladek , hare@suse.com, rwright@hpe.com, Jeff Mahoney , DSterba@suse.com, fdmanana@suse.com, neilb@suse.com, Guenter Roeck , rgoldwyn@suse.com, subashab@codeaurora.org, Heinrich Schuchardt , Aaron Tomlin , mbenes@suse.cz, "Paul E. McKenney" , Dan Williams , Josh Poimboeuf , "David S. Miller" , Ingo Molnar , Andrew Morton , Linus Torvalds , linux-kselftest@vger.kernel.org, "linux-doc@vger.kernel.org" , LKML Subject: Re: [RFC 03/10] kmod: add dynamic max concurrent thread count Message-ID: <20161208210039.GY1402@wotan.suse.de> References: <20161208184801.1689-1-mcgrof@kernel.org> <20161208194814.2485-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 08, 2016 at 12:28:07PM -0800, Kees Cook wrote: > On Thu, Dec 8, 2016 at 11:48 AM, Luis R. Rodriguez wrote: > > diff --git a/kernel/kmod.c b/kernel/kmod.c > > index 0277d1216f80..cb6f7ca7b8a5 100644 > > --- a/kernel/kmod.c > > +++ b/kernel/kmod.c > > @@ -44,6 +44,9 @@ > > @@ -186,6 +174,31 @@ int __request_module(bool wait, const char *fmt, ...) > > return ret; > > } > > EXPORT_SYMBOL(__request_module); > > + > > +/* > > + * If modprobe needs a service that is in a module, we get a recursive > > + * loop. Limit the number of running kmod threads to max_threads/2 or > > + * CONFIG_MAX_KMOD_CONCURRENT, whichever is the smaller. A cleaner method > > + * would be to run the parents of this process, counting how many times > > + * kmod was invoked. That would mean accessing the internals of the > > + * process tables to get the command line, proc_pid_cmdline is static > > + * and it is not worth changing the proc code just to handle this case. > > + * > > + * "trace the ppid" is simple, but will fail if someone's > > + * parent exits. I think this is as good as it gets. > > + * > > + * You can override with with a kernel parameter, for instance to allow > > + * 4096 concurrent modprobe instances: > > + * > > + * kmod.max_modprobes=4096 > > + */ > > +void __init init_kmod_umh(void) > > What does umh mean? umh is user mode helper. kmod.c actually implements the kernel's umh code. A subsequent series I will want to move all that to umh.c and keep module loading separate in kmod.c But that's for later as a cleanup. BTW any chance I can have you trim replies to file name and hunk for changes you reply to ? As an example I did that here :) Luis