Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2064310pxb; Mon, 20 Sep 2021 11:21:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/tDIlOYAmRtzut0mlmsMtweF13rKrjRZxkPxzzsVoRdAIRE8053u5pIfYzITjY1IDmyII X-Received: by 2002:a17:907:3e21:: with SMTP id hp33mr29835365ejc.205.1632162074854; Mon, 20 Sep 2021 11:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632162074; cv=none; d=google.com; s=arc-20160816; b=rPkc/E8Y1LE6Z4FiR2mLUdi9yukdUvlxVFBV2abTyDo0DzIWGZCgMWgjW6oHTa8zaC kelIK7amzOdgExGsJPqHx2I+bQps3SyuICuQ4WKWbdTly/CwSdo4zY6WPK688d2lHJhu +GvTk/HJ2O/Vf4cEUDEC/E/X24+xp+mn4+0c0UVzp5aBHilyxsPaX3idhVlVcKVHua8R i+CcOXNpBvqaSMMW35/CdCQtsjFxczQXvTakKE5IiUu3jeNDtprQ4KYv89efC/EF5FoC tXTmeFNu3P9V9bdwrIU2Z1gz+Wokp+z0OMlmhPunGVoCKsE/LuQ2LvuL5fNbBj5z7pZg GWdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rPf4aIjt28J9Hb/Zj4X/fJW+KULaG2Xw2AIXFCgCE+o=; b=FWvmFxZ0x4VEvlBO0V40fY6W+z8s1ffB/gy6hrr4xQJOM/+akCFwyP4hKByx1miOh4 MPYH1pVsyc5bko0iv2jT0/8FdjyFuE0q4jkyQ2EORJrfYU/7dwLIdxX1YzMBSn/GZ/9l bHKIrtNLUzd5YsF8kZLsEydbnvQsePu6L7uU1fIPrFXBUaaQqyoVfcnGzv6EO38z0lap U5u/nWrB4rZC5xfI+iZ9C+b+qnoQVMOgZ+xTxy9Xm8k34pL4xSj8Osug9r512JCAF6uW zr9i6vQ0EH290fhmLxs4Ovc/p4gokt/aGmCAadkzmhSnfkkFnaQFlStciodU1rKLpkUp Olow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=NQfJV104; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si16008741edq.553.2021.09.20.11.20.50; Mon, 20 Sep 2021 11:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=NQfJV104; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377468AbhITSTN (ORCPT + 99 others); Mon, 20 Sep 2021 14:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346019AbhITSNY (ORCPT ); Mon, 20 Sep 2021 14:13:24 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 892DDC06119C; Mon, 20 Sep 2021 09:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=rPf4aIjt28J9Hb/Zj4X/fJW+KULaG2Xw2AIXFCgCE+o=; b=NQfJV104PpHXxMpeZ80pOZx2sl PBipLdBg+fnggnwOis6OidrVtOoxklYVwV8bV2YLNBp2xB+ukUhTCtez48Ako1NJoXI+cmzMmgBUI sNLa6w1YwIijD40CFX6rT4Uh2FSufCfadBhVkYHt0xAEVnlUCjeCJuSZMxnJFYDE463z35lziNLfu eeqDn3SoNzWEDtgLnuHVlmPmM6YBAKG0sqPcy4ZffEwwT+bcDdDbaYjSfFB7hjOzXXttI8Ce20KPO 22/f+h2fuw+XFz0iFF3XE4kkS98u7t9/dyiq7HoXOVY51ChB06t3jvTx3FZ6bPWFO/cm0Rc1LM/E4 8fDL8XRw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSMdS-002Vfu-8Q; Mon, 20 Sep 2021 16:59:18 +0000 Date: Mon, 20 Sep 2021 09:59:18 -0700 From: Luis Chamberlain To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Andy Lutomirski , Christian Brauner , Linux API , Linux Kernel Mailing List , Jessica Yu Subject: Re: [RFC] Expose request_module via syscall Message-ID: References: <705fde50-37a6-49ed-b9c2-c9107cd88189@t-8ch.de> <20210916092719.v4pkhhugdiq7ytcp@wittgenstein> <2ebf1a9d-77d5-472b-a99a-b141654725da@www.fastmail.com> <6eff0e8a-4965-437d-9273-1d9d73892e1a@t-8ch.de> <8cbf0703-5734-4e92-a6cc-12de69094f95@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8cbf0703-5734-4e92-a6cc-12de69094f95@t-8ch.de> Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 20, 2021 at 04:51:19PM +0200, Thomas Weißschuh wrote: > On 2021-09-19T07:37-0700, Andy Lutomirski wrote: > > On Sun, Sep 19, 2021 at 12:56 AM Thomas Weißschuh wrote: > > > > > > On 2021-09-18T11:47-0700, Andy Lutomirski wrote: > > > > On Thu, Sep 16, 2021, at 2:27 AM, Christian Brauner wrote: > > > > > On Wed, Sep 15, 2021 at 09:47:25AM -0700, Andy Lutomirski wrote: > > > > > > On Wed, Sep 15, 2021 at 8:50 AM Thomas Weißschuh wrote: > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > I would like to propose a new syscall that exposes the functionality of > > > > > > > request_module() to userspace. > > > > > > > > > > > > > > Propsed signature: request_module(char *module_name, char **args, int flags); > > > > > > > Where args and flags have to be NULL and 0 for the time being. > > > > > > > > > > > > > > Rationale: > > > > > > > > > > > > > > We are using nested, privileged containers which are loading kernel modules. > > > > > > > Currently we have to always pass around the contents of /lib/modules from the > > > > > > > root namespace which contains the modules. > > > > > > > (Also the containers need to have userspace components for moduleloading > > > > > > > installed) > > > > > > > > > > > > > > The syscall would remove the need for this bookkeeping work. > > > > > > > > > > > > I feel like I'm missing something, and I don't understand the purpose > > > > > > of this syscall. Wouldn't the right solution be for the container to > > > > > > have a stub module loader (maybe doable with a special /sbin/modprobe > > > > > > or maybe a kernel patch would be needed, depending on the exact use > > > > > > case) and have the stub call out to the container manager to request > > > > > > the module? The container manager would check its security policy and > > > > > > load the module or not load it as appropriate. > > > > > > > > > > I don't see the need for a syscall like this yet either. > > > > > > > > > > This should be the job of the container manager. modprobe just calls the > > > > > init_module() syscall, right? > > > > > > > > Not quite so simple. modprobe parses things in /lib/modules and maybe /etc to decide what init_module() calls to do. > > > > > > > > But I admit I’m a bit confused. What exactly is the container doing that causes the container’s copy of modprobe to be called? > > > > > > The container is running an instance of the docker daemon in swarm mode. > > > That needs the "ip_vs" module (amongst others) and explicitly tries to load it > > > via modprobe. > > > > > > > Do you mean it literally invokes /sbin/modprobe? If so, hooking this > > at /sbin/modprobe and calling out to the container manager seems like > > a decent solution. > > Yes it does. Thanks for the idea, I'll see how this works out. Would documentation guiding you in that way have helped? If so I welcome a patch that does just that. Luis