Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3255605rwj; Mon, 19 Dec 2022 15:36:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXvnBN1JntSrtoYSemMXU5F0L8OX5bq6a47jOCDSb5ihTN6FfMXb+IbyhTC/dIjojdUuVxpA X-Received: by 2002:a05:6402:f8f:b0:477:e889:5533 with SMTP id eh15-20020a0564020f8f00b00477e8895533mr103677edb.25.1671492991328; Mon, 19 Dec 2022 15:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671492991; cv=none; d=google.com; s=arc-20160816; b=eLBVZlW/uVVj7+bTzOSZmt+/5FXlSrSLWtoSl9+YlU96pNi6Gjr2HFk3rAjHYWMwsS Z+vUeNDkhHUJuXng7m1aSkck2B3xPmZEliJuEa7/zokxZ6y+8MtIrrUi87/1perkoe4/ rMNfN096zwK8v1Ibb6qnemsUBzoJ9/eK6f/S0bI9ic//hJjb/juXuu/D2sFP+u1HzDlD 3za/NIcTUN28/Bkp0kW8j88B0ZVihTlQckRKgaGaqblUQIFpLw4KYL+cJIx2MThXm7Q+ NclmS9TShtykCAAt43tSlr+oUcX3tZyuQFWMksNX/tisjdVGtZA55eYatoKAlmCmY8Lo 2gNA== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xJMn3SSDJKFszpMyORiiJWCILxdNMFNpaPjY/K6/F2s=; b=R2bUjlRs3DOASWzdxxTV5T4tLGohkGrvgtlKGjIkOVKWHw8kYedGp3aHdPxpLE7ynu Y/sX7bETLR6iVu8gCpZF9hxlid4sFKi/N6WYQfymZBegnsalGnqduEcJB763fCe6Mf33 DWjvhh55HEMOfpXGNwgPIEbbQLB8sxs1QW22ZVJS64OXjv2x03nbDG7EVCJD3IdYC1ff FwVmWqWzzox9K0eytosJAfJyVtbRqqTKftu5yhZ5jpBu0Cli0kc9qMRyDYYWTmC8q0ax 1tKCBxJXTNuhfdQOuxj+HPk735zeEwGLqINn1Cov1ezLrA5eZ7TKai7ePVY6MyTVuBGm 7GXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=fgsrb98m; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a056402518d00b004690097d852si11525424edd.252.2022.12.19.15.36.14; Mon, 19 Dec 2022 15:36:31 -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=@infradead.org header.s=bombadil.20210309 header.b=fgsrb98m; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbiLSWvh (ORCPT + 70 others); Mon, 19 Dec 2022 17:51:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiLSWvf (ORCPT ); Mon, 19 Dec 2022 17:51:35 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB2A12751; Mon, 19 Dec 2022 14:51:33 -0800 (PST) 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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xJMn3SSDJKFszpMyORiiJWCILxdNMFNpaPjY/K6/F2s=; b=fgsrb98mVMothA1lubXWJtS4Oa GMAxUsiio4APIjRa/tjILRGYIn61EKec4ojUKSPoSnVq+ME79R8+hU63BehnC57XTRvK28vXbpsGZ N/nBqOJHJReOa+xu6rEV1xBflktzYljue8uQkvIx/R2QK2gZdBZKor54BBrY5SEcquaxaQ6beVJ0T F5q+Ul8tbdsV1ygbQXLrXkOOS9k65n6NRh/+F1W1usqGuQ8+ZmBk1OQTFyh1Nere57MFjyyPbL30Q j0TkaUBEbwiECM71i2X4h5kApNqEc6PRqsKk76JxnkS15ateu/fVfHcUvvMT8yH+YkjXTdiQiJDEo i3r/Aa/A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7Oyq-004hRt-0I; Mon, 19 Dec 2022 22:51:32 +0000 Date: Mon, 19 Dec 2022 14:51:31 -0800 From: Luis Chamberlain To: Allen Webb Cc: "linux-modules@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: Re: [PATCH v9 10/10] docs: Include modules.builtin.alias Message-ID: References: <20221219191855.2010466-1-allenwebb@google.com> <20221219204619.2205248-1-allenwebb@google.com> <20221219204619.2205248-11-allenwebb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 19, 2022 at 04:20:41PM -0600, Allen Webb wrote: > On Mon, Dec 19, 2022 at 4:07 PM Luis Chamberlain 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 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 > > > > > --- > > > > > 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