From patchwork Mon Sep 21 19:15:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Hicks X-Patchwork-Id: 11790775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 720F659D for ; Mon, 21 Sep 2020 19:17:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B987216C4 for ; Mon, 21 Sep 2020 19:17:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B+JxHGat"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="Bbcp4de/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B987216C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=fqjsgBHSMDiil/XFNdrmLPNQUYGp08AE/X7rmtLdyhQ=; b=B+JxHGatd4jppEKvQDjbYL1pvl leLr0VwjvXmyBYi3iHEa0XTFTZbFFCbCNQ3RE0FAyLYkB9F6lNKGRiduWJuBKk/ywHdzRjZ04UFps 9Dg8z4OlT4qAZm8ddIPBJJ75FwlYJL74f1GSafnfVRN/83/SNw67zmTvybY0ec0cz/c35PqyKl4Sn 6ZQ3leWRVHw6OXtWmV82IPYRQB2O+h36Nu9dzU1iGK6VDwHRy9pvu1wi1Tlp+ho34G8uvqqy2KzZf P9wvOyqutBqCm1NWfE6C0NKpT9oum/+Z8ag8id9L7liRq7oV/xLf7mTbh7Zoly8H9n+50HcXNBkTc 4FnDHAiA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKRIX-0007sM-9f; Mon, 21 Sep 2020 19:16:25 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKRIU-0007rH-8l for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2020 19:16:23 +0000 Received: from sequoia.work.tihix.com (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id 63F5920B7179; Mon, 21 Sep 2020 12:16:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 63F5920B7179 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1600715779; bh=bAvtruGL6eb8K//9E5HUFx+RIR5erE8cJVQBiE7jV4A=; h=From:To:Cc:Subject:Date:From; b=Bbcp4de/s3kSsU86og09oMnY1wV6mpagBU2CMnh/oQ4mNjXQP8vcBC+d7cwEI2rG9 S+PNYc4CDpaP7heM6dXVXNbeBhQhrQZfYYtfeysZNb0btEM+PkNMhH4KdiXQyPiKC1 HZ+uMhQ3xyPOeETuC6QmJnX85XerFZON2m6NyFrc= From: Tyler Hicks To: Catalin Marinas , Will Deacon Subject: [PATCH 0/2] arm64: Implement CONFIG_CMDLINE_EXTEND Date: Mon, 21 Sep 2020 14:15:55 -0500 Message-Id: <20200921191557.350256-1-tyhicks@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_151622_447100_2B9FF0DF X-CRM114-Status: GOOD ( 16.38 ) X-Spam-Score: -17.9 (-----------------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-17.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [13.77.154.182 listed in list.dnswl.org] -7.5 USER_IN_DEF_SPF_WL From: address is in the default SPF white-list -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.5 ENV_AND_HDR_SPF_MATCH Env and Hdr From used in default SPF WL Match X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Pavel Tatashin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Provide the CONFIG_CMDLINE_EXTEND config option for arm64 kernels. This config option can be used to extend the kernel command line parameters, specified by the bootloader, with additional command line parameters specified in the kernel configuration. This option addresses the following use cases: 1) Switching between stable and development kernel versions, where one of the versions benefits from additional command line parameters, such as debugging options. 2) Specifying additional command line parameters, for additional tuning or debugging, when the bootloader does not offer an interactive mode. After implementing these patches, I noticed that a previous attempt has been made to upstream CONFIG_CMDLINE_EXTEND support in arm64: https://lore.kernel.org/linux-arm-kernel/1447838885-9888-1-git-send-email-p.fedin@samsung.com/ I don't believe that the previous objection still holds as the generic command line parsing series hasn't been revised in over a year. This series is based on commit f322010a08da ("Merge branch 'for-next/mte' into for-next/core") of the for-next/core branch of the arm64 tree. Below is a summary of testing that I performed. Upgrade testing: * CONFIG_CMDLINE unset - oldconfig target doesn't prompt, * CONFIG_CMDLINE set, CONFIG_CMDLINE_FORCE unset - oldconfig target prompts for command line type with default choice set to CONFIG_CMDLINE_FROM_BOOTLOADER * CONFIG_CMDLINE set, CONFIG_CMDLINE_FORCE set - oldconfig target prompts for command line type with default choice set to CONFIG_CMDLINE_FORCE Functional testing: * Set CONFIG_CMDLINE="nokaslr apparmor=0" and CONFIG_CMDLINE_EXTEND=y to test early init parsing and regular parsing - /proc/cmdline shows that "nokaslr apparmor=0" was appended to the end of the bootloader supplied command line - "KASLR disabled on command line" found in dmesg - AppArmor is disabled. /sys/kernel/security/apparmor does not exist and aa-status prints: apparmor module is loaded. apparmor filesystem is not mounted. * Set CONFIG_CMDLINE="nokaslr apparmor=0", CONFIG_CMDLINE_FROM_BOOTLOADER=y, and have the bootloader specify a command line without those options - The bootloader's command line is used and does not contain CONFIG_CMDLINE's value - AppArmor and KASLR are enabled * Set CONFIG_CMDLINE="nokaslr apparmor=0" and CONFIG_CMDLINE_FORCE=y - The CONFIG_CMDLINE value is used and does not contain the bootloader's command line - AppArmor and KASLR are disabled Tyler Tyler Hicks (2): arm64: kaslr: Refactor early init command line parsing arm64: Extend the kernel command line from the bootloader arch/arm64/Kconfig | 23 ++++++++++++++++++++++- arch/arm64/kernel/kaslr.c | 26 ++++++++++++++++++-------- 2 files changed, 40 insertions(+), 9 deletions(-)