From patchwork Fri Jun 19 16:15:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1313072 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 49pP870ZVfz9t79; Sat, 20 Jun 2020 02:16:55 +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 1jmJhA-0002LY-EC; Fri, 19 Jun 2020 16:16:48 +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 1jmJh0-0002CQ-OY for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:16:38 +0000 Received: from mail-il1-f197.google.com ([209.85.166.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jmJgz-0003a9-2H for kernel-team@lists.ubuntu.com; Fri, 19 Jun 2020 16:16:37 +0000 Received: by mail-il1-f197.google.com with SMTP id a4so6822069ilq.2 for ; Fri, 19 Jun 2020 09:16:37 -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=w2J9bq1jc2+eFfA0FNWUc5i8SCn0Cg7uiLuKmEbT3so=; b=PxD6X/uR/i2H0XWoyQQmQhFwqteXxKpA+3AcNEiz/Xz0jLJo0csWk6CNWfjjtCJhbx FONIZce36T9PB3NAP3x467w6OfowtNqGNznVJiJq6cgmOtYgPta/LY8lF6OBXH/x9ViV HbGOgvC8KUJ8CftlIWcBLDtrw8vy62S3QtkuUpoq58wbJZhnvUF28W59NZzLF8u1JZX9 Qy2HeltE6yuzTl1SG+cdXQY+BjxDHNO0Ng2N2dicMrWVuhe9p5XRsb6kJ56eiJJSKl4A tClJJG0XJCCoTFqIxklRIXoqE4p4V/+fLOZhochSrhUl+1Vuh0GBmrghPYb7SyWzBfK+ a1Cg== X-Gm-Message-State: AOAM530p125jPDwqSUqEOxNzGN+6FHTYhMX/qaQ38D5ozRZjCdVtdLCl i835HiTLZ7ftbs/yhfTSsSU/KkVHLd4Tta9Hl579/qW6tLKQNviRfhxVxpD/qEMhKIiUS2QArFW D0jMEFtmwNtQ8IgAShHMlksfCSkhYzJ7baSjnC2yQng== X-Received: by 2002:a05:6602:25d3:: with SMTP id d19mr5250677iop.15.1592583395866; Fri, 19 Jun 2020 09:16:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt00lTz1oOH2woafRya9Ov3R6nRCBDHRCUV4bONO8mj48z/Q/l8Cqbn742iD3jAqM1/B4+dw== X-Received: by 2002:a05:6602:25d3:: with SMTP id d19mr5250656iop.15.1592583395598; Fri, 19 Jun 2020 09:16:35 -0700 (PDT) Received: from localhost ([2605:a601:ac0f:820:f090:1573:c2fc:6389]) by smtp.gmail.com with ESMTPSA id v2sm3606895iol.36.2020.06.19.09.16.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:16:35 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 10/57][B] Annotate hardware config module parameters in drivers/char/ Date: Fri, 19 Jun 2020 11:15:34 -0500 Message-Id: <20200619161621.644540-11-seth.forshee@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619161621.644540-1-seth.forshee@canonical.com> References: <20200619161621.644540-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/. Suggested-by: Alan Cox Signed-off-by: David Howells Acked-by: Greg Kroah-Hartman cc: Arnd Bergmann (cherry picked from commit 1c37ab5e51792a5419bdc84804aec6379cb43adb) Signed-off-by: Seth Forshee --- drivers/char/applicom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 9fcd51095d13..aeb0b876bb19 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -95,9 +95,9 @@ static struct applicom_board { static unsigned int irq = 0; /* interrupt number IRQ */ static unsigned long mem = 0; /* physical segment of board */ -module_param(irq, uint, 0); +module_param_hw(irq, uint, irq, 0); MODULE_PARM_DESC(irq, "IRQ of the Applicom board"); -module_param(mem, ulong, 0); +module_param_hw(mem, ulong, iomem, 0); MODULE_PARM_DESC(mem, "Shared Memory Address of Applicom board"); static unsigned int numboards; /* number of installed boards */