From patchwork Thu Jun 18 23:12:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1312450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49nyR90SCwz9sR4; Fri, 19 Jun 2020 09:13:25 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jm3ih-00086R-J5; Thu, 18 Jun 2020 23:13:19 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jm3ia-00080z-Ja for kernel-team@lists.ubuntu.com; Thu, 18 Jun 2020 23:13:12 +0000 Received: from mail-il1-f199.google.com ([209.85.166.199]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jm3iZ-0008PE-IA for kernel-team@lists.ubuntu.com; Thu, 18 Jun 2020 23:13:11 +0000 Received: by mail-il1-f199.google.com with SMTP id q24so5126679ili.12 for ; Thu, 18 Jun 2020 16:13:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AzqbAC/ES63EnFAvo4b4A9hsSBPEa2/RCHMG4gU+vck=; b=fB/5s1yeues5t+Cm90wiJ/vBw6MmghhjFyG5SjU/9Ur60K5PsTZKz/BLi4sk8cAv4f T5+01mn1OYIREpxGq0Eer0Y6PC+rzLCCUsa8r+xFx5+rHud25UldzvAxRqDXJ+7FtVk/ TwYNXxzPEEMK9qLqG2CfqZfPvp6goiF+lToZVmwnR194ToPDxNdISXBztWAvqiNS3z1U /AJGoJLsCdQi+HaW+IIH9KxL42eZpTlIFHrTym4qGTjGX+JzS//yum3QTS0FbjD78eQ8 1K4+AFy9SsS0B5wYXXxfd3NGQd8uLjzK9lscaZWx63PNe0uMFAt1miVrI0d6Mz9n+9no Is+g== X-Gm-Message-State: AOAM530WEcGvMTDUMQWphoLP/FAY/CUfseV9kzoC6zQ49x2LwCNfXgUk MhM8VAw1ekP4hj3G/TJ8mDfnDvyqBLZmz8sl+iJF57B/ZqtLNIwFPiTOdZXVcT5b3A0jTqm3VTi 8yJw7RnohxsYn+S7EwUwj1ExIeOH8V9T74rZbpktQuA== X-Received: by 2002:a92:4852:: with SMTP id v79mr901938ila.172.1592521990450; Thu, 18 Jun 2020 16:13:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1fBZfaqTT00u8n4Fw0RG8FLQ1Ze5myphqpeMkKrnUhmnGauraZHhvWt7sXMm+BZZOG7u7pQ== X-Received: by 2002:a92:4852:: with SMTP id v79mr901914ila.172.1592521990226; Thu, 18 Jun 2020 16:13:10 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:f090:1573:c2fc:6389]) by smtp.gmail.com with ESMTPSA id z4sm2205535ilm.72.2020.06.18.16.13.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 16:13:09 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 09/47][X] Annotate hardware config module parameters in drivers/char/mwave/ Date: Thu, 18 Jun 2020 18:12:20 -0500 Message-Id: <20200618231258.630575-10-seth.forshee@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200618231258.630575-1-seth.forshee@canonical.com> References: <20200618231258.630575-1-seth.forshee@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: David Howells BugLink: https://bugs.launchpad.net/bugs/1884159 When the kernel is running in secure boot mode, we lock down the kernel to prevent userspace from modifying the running kernel image. Whilst this includes prohibiting access to things like /dev/mem, it must also prevent access by means of configuring driver modules in such a way as to cause a device to access or modify the kernel image. To this end, annotate module_param* statements that refer to hardware configuration and indicate for future reference what type of parameter they specify. The parameter parser in the core sees this information and can skip such parameters with an error message if the kernel is locked down. The module initialisation then runs as normal, but just sees whatever the default values for those parameters is. Note that we do still need to do the module initialisation because some drivers have viable defaults set in case parameters aren't specified and some drivers support automatic configuration (e.g. PNP or PCI) in addition to manually coded parameters. This patch annotates drivers in drivers/char/mwave/. Suggested-by: Alan Cox Signed-off-by: David Howells (cherry picked from commit 94b599bc07c3c4f365f546218918dcbc363111b2) Signed-off-by: Seth Forshee --- drivers/char/mwave/mwavedd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index 618f3df6c3b9..19c11efe78b1 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c @@ -81,10 +81,10 @@ int mwave_3780i_io = 0; int mwave_uart_irq = 0; int mwave_uart_io = 0; module_param(mwave_debug, int, 0); -module_param(mwave_3780i_irq, int, 0); -module_param(mwave_3780i_io, int, 0); -module_param(mwave_uart_irq, int, 0); -module_param(mwave_uart_io, int, 0); +module_param_hw(mwave_3780i_irq, int, irq, 0); +module_param_hw(mwave_3780i_io, int, ioport, 0); +module_param_hw(mwave_uart_irq, int, irq, 0); +module_param_hw(mwave_uart_io, int, ioport, 0); static int mwave_open(struct inode *inode, struct file *file); static int mwave_close(struct inode *inode, struct file *file);