Message ID | 20221219204619.2205248-11-allenwebb@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2607875wrn; Mon, 19 Dec 2022 12:48:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wZUnehlfKqKoOD+XXim29ofMlhRD/Y18K7hqp/JcDR/zfeBhQidbLm48z7xsrgMNzcqHU X-Received: by 2002:a17:902:7242:b0:18f:a4e1:9908 with SMTP id c2-20020a170902724200b0018fa4e19908mr33369806pll.15.1671482938173; Mon, 19 Dec 2022 12:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671482938; cv=none; d=google.com; s=arc-20160816; b=nNBysl3cCKuucnZiCZl9cBBdWStBokWnZ+sGESJX8OMcUdTPSMgaZxR02u7Ra6/qWk Otzg+chBN0C8ggi2Y0+EcQVxQHiHC++CCnjhJsc79pl67ZlwLQD0tQ++JypDTqeSwFbN WC9R0efCcpQkw4mzerRzP8MC4liIRS9MiuBuYbol7LOwGyLi3wzZnwc7OF1UL8w4kziS v+yV6nBcRKRHfD4y8dHYmY0V3OC+9VoZcNtxNO44hiQbZQT4rWa5rh6mFwHNdtk0xe/0 3eFOk5UdGKGfYLUZK58qoyLy1R21IG+BskTzumy3Z6/UalXdcyEaMuHZJ48AqQmePEcD 6d+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=ffbS/pv8mbkzwi7BuDuXxKBVWgm3Q+ZGzVMRzNeN5+Y=; b=Cq2dzCLNpJCwGoljRW6wS50tFJ6jnpukhfiF4VqJDHyHGv+XLUVvD/ZfZMjrl9cm8w FzdLf3CkZPI4VBaV9FZ+V2rPVH4KM/X6pjzTw422MJka70ul8h8fP6bXxNF3AylSzoPa iCSC61hNNy7tWq9d6FTh16xPFrPISMOW08/zk9uPM8xEfrIdBVubdFkBSCxMRtTthCjI UTEGspvyVb4x6wscQK/2Qr4sRDjVM5plq1uwDfKuWVMLabb3k4fl03604gqxfKGFr9ul 2QRvlhFKhNwNb3EupAJ4yIWJN5n7c4ZTV8ERX04dC+MIND9MeuwSNB2ZHxB7PfzPRU4H EIIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=P+tl9R92; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a17090332c700b0018922404e22si12944203plr.474.2022.12.19.12.48.45; Mon, 19 Dec 2022 12:48:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=P+tl9R92; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232876AbiLSUrc (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Mon, 19 Dec 2022 15:47:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232714AbiLSUqn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Dec 2022 15:46:43 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4888E13D05 for <linux-kernel@vger.kernel.org>; Mon, 19 Dec 2022 12:46:33 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-3ceb4c331faso120155937b3.2 for <linux-kernel@vger.kernel.org>; Mon, 19 Dec 2022 12:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ffbS/pv8mbkzwi7BuDuXxKBVWgm3Q+ZGzVMRzNeN5+Y=; b=P+tl9R92zOQTC3t4VBw6Y+REEQFR+YIPONKj6GW/JEp8bc5No52C7OOCdrsY39r2pk ySPHB3qcvlRU5J3a0c1HKvTnRbrxxdIckGKtiUEsyPUN5l0UfD7v1cnFyxsrMHjSeg9k ntwmZ6EMaNMngUAGGGjhgxLGtrqzmZppNYMUFeLMBFNfhfJNRapWUo64IFmy95TDVTW6 eYrn2ifH7UePSbFRu2IUDUsVJRJvY1OfevX06T1K98mae5bCESQfnTcEHkMzZpKmcw2g 1P8ECfIrvtAqhfF2Tnx6DZS+hcBtScf5fdyw1R4krdijYiv/Vn51BrnMfhW4zs8gKpg2 1oQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ffbS/pv8mbkzwi7BuDuXxKBVWgm3Q+ZGzVMRzNeN5+Y=; b=3bUe0pSSFP1nrFrcl1rsRUPxNHgfSHEm6ahJ1udDT9L8wUsLf71auz4qLEUax77r2g BVq+kOes1YAACa+saiczpL0qUKgx0WXKD2DTvOtabys4Hv/PY9lRaZV/onIYITydsQpp abm9/W8p81oDpxlIWsNo3r+g6Bdw7vycQCZgtuJy/QcN8fB36luwhdQoDvrV49aizIU+ 1+fjT3Q3pd5xVBlk4vDUmMB6sNyscH80L8uaZedQ7+Z9Tgo1eXLbcu13X3RCh6VcjiEr BXBjF39hBn2/uMcqi6WNX4jaZ/3WCwbilbW2iCHZ1mEfXG1ciif5TLa9OfYSd68YxGZw 2bRA== X-Gm-Message-State: ANoB5pnx6K639wrORXO52t5cvZLhJ7/Uzx9uAw+bMY5TA/kf5y0HJkpT T0DlDJrqFuQTIoq8npZCogsT3CxHw5lofvE= X-Received: from allenwebb.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:12e8]) (user=allenwebb job=sendgmr) by 2002:a05:690c:ec2:b0:3bd:7135:c319 with SMTP id cs2-20020a05690c0ec200b003bd7135c319mr4467546ywb.89.1671482792621; Mon, 19 Dec 2022 12:46:32 -0800 (PST) Date: Mon, 19 Dec 2022 14:46:18 -0600 In-Reply-To: <20221219204619.2205248-1-allenwebb@google.com> Mime-Version: 1.0 References: <20221219191855.2010466-1-allenwebb@google.com> <20221219204619.2205248-1-allenwebb@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221219204619.2205248-11-allenwebb@google.com> Subject: [PATCH v9 10/10] docs: Include modules.builtin.alias From: Allen Webb <allenwebb@google.com> To: "linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>, "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Cc: Luis Chamberlain <mcgrof@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Allen Webb <allenwebb@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752676893392192877?= X-GMAIL-MSGID: =?utf-8?q?1752676893392192877?= |
Series |
Generate modules.builtin.alias from match ids
|
|
Commit Message
Allen Webb
Dec. 19, 2022, 8:46 p.m. UTC
Update the documentation to include the presense and use case of
modules.builtin.alias.
Signed-off-by: Allen Webb <allenwebb@google.com>
---
Documentation/kbuild/kbuild.rst | 6 ++++++
1 file changed, 6 insertions(+)
Comments
Please disregard this patch. I updated the commit message and this was hanging around in my outgoing directory afterward. On Mon, Dec 19, 2022 at 2:46 PM Allen Webb <allenwebb@google.com> wrote: > > Update the documentation to include the presense and use case of > modules.builtin.alias. > > Signed-off-by: Allen Webb <allenwebb@google.com> > --- > Documentation/kbuild/kbuild.rst | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst > index 08f575e6236c..1c7c02040a54 100644 > --- a/Documentation/kbuild/kbuild.rst > +++ b/Documentation/kbuild/kbuild.rst > @@ -17,6 +17,12 @@ modules.builtin > This file lists all modules that are built into the kernel. This is used > by modprobe to not fail when trying to load something builtin. > > +modules.builtin.alias > +--------------------- > +This file lists all match-id based aliases for modules built into the kernel. > +These are intended to enable userspace to make authorization decisions based > +on which modules are likely to be bound to a device after it is authorized. > + > modules.builtin.modinfo > ----------------------- > This file contains modinfo from all modules that are built into the kernel. > -- > 2.37.3 >
On Mon, Dec 19, 2022 at 02:46:18PM -0600, Allen Webb wrote: > Update the documentation to include the presense and use case of > modules.builtin.alias. > > Signed-off-by: Allen Webb <allenwebb@google.com> > --- > Documentation/kbuild/kbuild.rst | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst > index 08f575e6236c..1c7c02040a54 100644 > --- a/Documentation/kbuild/kbuild.rst > +++ b/Documentation/kbuild/kbuild.rst > @@ -17,6 +17,12 @@ modules.builtin > This file lists all modules that are built into the kernel. This is used > by modprobe to not fail when trying to load something builtin. > > +modules.builtin.alias > +--------------------- > +This file lists all match-id based aliases for modules built into the kernel. > +These are intended to enable userspace to make authorization decisions based > +on which modules are likely to be bound to a device after it is authorized. What is an example? This sounds obscure. Luis
On Mon, Dec 19, 2022 at 3:23 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > On Mon, Dec 19, 2022 at 02:46:18PM -0600, Allen Webb wrote: > > Update the documentation to include the presense and use case of > > modules.builtin.alias. > > > > Signed-off-by: Allen Webb <allenwebb@google.com> > > --- > > Documentation/kbuild/kbuild.rst | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst > > index 08f575e6236c..1c7c02040a54 100644 > > --- a/Documentation/kbuild/kbuild.rst > > +++ b/Documentation/kbuild/kbuild.rst > > @@ -17,6 +17,12 @@ modules.builtin > > This file lists all modules that are built into the kernel. This is used > > by modprobe to not fail when trying to load something builtin. > > > > +modules.builtin.alias > > +--------------------- > > +This file lists all match-id based aliases for modules built into the kernel. > > +These are intended to enable userspace to make authorization decisions based > > +on which modules are likely to be bound to a device after it is authorized. > > What is an example? This sounds obscure. Many of the devices that match the usb_storage driver only specify the vendor id, product id, and device id (VID:PID:D) and do not match against device class, interface class, etc. Here are some examples from modules.alias: A grep for wildcards in these fields yields 6136 matches: grep 'dc\*dsc\*dp\*ic\*isc\*ip\*in\*' /lib/modules/5.19.11-1rodete1-amd64/modules.alias | wc -l 6136 To write USBGuard policy that only authorizes devices that bind to a particular module the policy needs to be aware of all these VID:PID:D which can change between kernel versions. This is done at runtime rather than excluding modules from the build because some devices are not needed at or before login or when a device is locked. By not authorizing new devices that would bind to a set of modules, these modules become unreachable to an attacker who seeks to exploit kernel bugs in those modules. I could add this detail to the documentation file, but I was trying to keep the description to about the same length as the others around it. > > Luis
On Mon, Dec 19, 2022 at 03:40:42PM -0600, Allen Webb wrote: > On Mon, Dec 19, 2022 at 3:23 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > > > On Mon, Dec 19, 2022 at 02:46:18PM -0600, Allen Webb wrote: > > > Update the documentation to include the presense and use case of > > > modules.builtin.alias. > > > > > > Signed-off-by: Allen Webb <allenwebb@google.com> > > > --- > > > Documentation/kbuild/kbuild.rst | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst > > > index 08f575e6236c..1c7c02040a54 100644 > > > --- a/Documentation/kbuild/kbuild.rst > > > +++ b/Documentation/kbuild/kbuild.rst > > > @@ -17,6 +17,12 @@ modules.builtin > > > This file lists all modules that are built into the kernel. This is used > > > by modprobe to not fail when trying to load something builtin. > > > > > > +modules.builtin.alias > > > +--------------------- > > > +This file lists all match-id based aliases for modules built into the kernel. > > > +These are intended to enable userspace to make authorization decisions based > > > +on which modules are likely to be bound to a device after it is authorized. > > > > What is an example? This sounds obscure. > > Many of the devices that match the usb_storage driver only specify the > vendor id, product id, and device id (VID:PID:D) and do not match > against device class, interface class, etc. Here are some examples > from modules.alias: A grep for wildcards in these fields yields 6136 > matches: > grep 'dc\*dsc\*dp\*ic\*isc\*ip\*in\*' > /lib/modules/5.19.11-1rodete1-amd64/modules.alias | wc -l > 6136 > > To write USBGuard policy that only authorizes devices that bind to a > particular module the policy needs to be aware of all these VID:PID:D > which can change between kernel versions. > > This is done at runtime rather than excluding modules from the build > because some devices are not needed at or before login or when a > device is locked. By not authorizing new devices that would bind to a > set of modules, these modules become unreachable to an attacker who > seeks to exploit kernel bugs in those modules. > > I could add this detail to the documentation file, but I was trying to > keep the description to about the same length as the others around it. How about the second sentence you wrote say something like: An example usage of the built-in aliases is to enable software such as USBGuard to enable / disable specific devices outside of just the vendor, product and device ID. This allows more flexible security policies in userspace. Luis
On Mon, Dec 19, 2022 at 4:07 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > On Mon, Dec 19, 2022 at 03:40:42PM -0600, Allen Webb wrote: > > On Mon, Dec 19, 2022 at 3:23 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > > > > > On Mon, Dec 19, 2022 at 02:46:18PM -0600, Allen Webb wrote: > > > > Update the documentation to include the presense and use case of > > > > modules.builtin.alias. > > > > > > > > Signed-off-by: Allen Webb <allenwebb@google.com> > > > > --- > > > > Documentation/kbuild/kbuild.rst | 6 ++++++ > > > > 1 file changed, 6 insertions(+) > > > > > > > > diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst > > > > index 08f575e6236c..1c7c02040a54 100644 > > > > --- a/Documentation/kbuild/kbuild.rst > > > > +++ b/Documentation/kbuild/kbuild.rst > > > > @@ -17,6 +17,12 @@ modules.builtin > > > > This file lists all modules that are built into the kernel. This is used > > > > by modprobe to not fail when trying to load something builtin. > > > > > > > > +modules.builtin.alias > > > > +--------------------- > > > > +This file lists all match-id based aliases for modules built into the kernel. > > > > +These are intended to enable userspace to make authorization decisions based > > > > +on which modules are likely to be bound to a device after it is authorized. > > > > > > What is an example? This sounds obscure. > > > > Many of the devices that match the usb_storage driver only specify the > > vendor id, product id, and device id (VID:PID:D) and do not match > > against device class, interface class, etc. Here are some examples > > from modules.alias: A grep for wildcards in these fields yields 6136 > > matches: > > grep 'dc\*dsc\*dp\*ic\*isc\*ip\*in\*' > > /lib/modules/5.19.11-1rodete1-amd64/modules.alias | wc -l > > 6136 > > > > To write USBGuard policy that only authorizes devices that bind to a > > particular module the policy needs to be aware of all these VID:PID:D > > which can change between kernel versions. > > > > This is done at runtime rather than excluding modules from the build > > because some devices are not needed at or before login or when a > > device is locked. By not authorizing new devices that would bind to a > > set of modules, these modules become unreachable to an attacker who > > seeks to exploit kernel bugs in those modules. > > > > I could add this detail to the documentation file, but I was trying to > > keep the description to about the same length as the others around it. > > How about the second sentence you wrote say something like: > > An example usage of the built-in aliases is to enable software such as > USBGuard to enable / disable specific devices outside of just the > vendor, product and device ID. This allows more flexible security policies > in userspace. I tweaked it a tiny bit, but that makes the whole description: This file lists all match-id based aliases for modules built into the kernel. An example usage of the built-in aliases is to enable software such as USBGuard to allow or block devices outside of just the vendor, product, and device ID. This enables more flexible security policies in userspace. > > Luis
On Mon, Dec 19, 2022 at 04:20:41PM -0600, Allen Webb wrote: > On Mon, Dec 19, 2022 at 4:07 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > > > On Mon, Dec 19, 2022 at 03:40:42PM -0600, Allen Webb wrote: > > > On Mon, Dec 19, 2022 at 3:23 PM Luis Chamberlain <mcgrof@kernel.org> wrote: > > > > > > > > On Mon, Dec 19, 2022 at 02:46:18PM -0600, Allen Webb wrote: > > > > > Update the documentation to include the presense and use case of > > > > > modules.builtin.alias. > > > > > > > > > > Signed-off-by: Allen Webb <allenwebb@google.com> > > > > > --- > > > > > Documentation/kbuild/kbuild.rst | 6 ++++++ > > > > > 1 file changed, 6 insertions(+) > > > > > > > > > > diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst > > > > > index 08f575e6236c..1c7c02040a54 100644 > > > > > --- a/Documentation/kbuild/kbuild.rst > > > > > +++ b/Documentation/kbuild/kbuild.rst > > > > > @@ -17,6 +17,12 @@ modules.builtin > > > > > This file lists all modules that are built into the kernel. This is used > > > > > by modprobe to not fail when trying to load something builtin. > > > > > > > > > > +modules.builtin.alias > > > > > +--------------------- > > > > > +This file lists all match-id based aliases for modules built into the kernel. > > > > > +These are intended to enable userspace to make authorization decisions based > > > > > +on which modules are likely to be bound to a device after it is authorized. > > > > > > > > What is an example? This sounds obscure. > > > > > > Many of the devices that match the usb_storage driver only specify the > > > vendor id, product id, and device id (VID:PID:D) and do not match > > > against device class, interface class, etc. Here are some examples > > > from modules.alias: A grep for wildcards in these fields yields 6136 > > > matches: > > > grep 'dc\*dsc\*dp\*ic\*isc\*ip\*in\*' > > > /lib/modules/5.19.11-1rodete1-amd64/modules.alias | wc -l > > > 6136 > > > > > > To write USBGuard policy that only authorizes devices that bind to a > > > particular module the policy needs to be aware of all these VID:PID:D > > > which can change between kernel versions. > > > > > > This is done at runtime rather than excluding modules from the build > > > because some devices are not needed at or before login or when a > > > device is locked. By not authorizing new devices that would bind to a > > > set of modules, these modules become unreachable to an attacker who > > > seeks to exploit kernel bugs in those modules. > > > > > > I could add this detail to the documentation file, but I was trying to > > > keep the description to about the same length as the others around it. > > > > How about the second sentence you wrote say something like: > > > > An example usage of the built-in aliases is to enable software such as > > USBGuard to enable / disable specific devices outside of just the > > vendor, product and device ID. This allows more flexible security policies > > in userspace. > > I tweaked it a tiny bit, but that makes the whole description: > > This file lists all match-id based aliases for modules built into the kernel. > An example usage of the built-in aliases is to enable software such as > USBGuard to allow or block devices outside of just the vendor, product, and > device ID. This enables more flexible security policies in userspace. Now, without ever readng your patchset and intentions I can easily grasp what your goals are. Looks good. Feel free to add my Reviewed-by tags for this patch. Luis
diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst index 08f575e6236c..1c7c02040a54 100644 --- a/Documentation/kbuild/kbuild.rst +++ b/Documentation/kbuild/kbuild.rst @@ -17,6 +17,12 @@ modules.builtin This file lists all modules that are built into the kernel. This is used by modprobe to not fail when trying to load something builtin. +modules.builtin.alias +--------------------- +This file lists all match-id based aliases for modules built into the kernel. +These are intended to enable userspace to make authorization decisions based +on which modules are likely to be bound to a device after it is authorized. + modules.builtin.modinfo ----------------------- This file contains modinfo from all modules that are built into the kernel.