From patchwork Wed Sep 23 16:13:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 254206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBCCFC4727F for ; Wed, 23 Sep 2020 16:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6354820936 for ; Wed, 23 Sep 2020 16:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877700; bh=jBPk9GYHchZOkBmUWbnB7ym+PkKvrGJQed6G/FmGfrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xgEgFKAaYA8XwEXFYwDn8JzRMi+tggIbA4u/kkebK2PVy1V9uv0lZWUypRQBr0CxP 12P9K45z3wqlYgMDoqGXGTsHZwdc1X3nNxjnc+RyvT1QGd/Z5ohM39VVowAK957N23 9F2B6hXYhKbKks+mF+R5xHslv/Hdtt2qm4lpApK8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726678AbgIWQO7 (ORCPT ); Wed, 23 Sep 2020 12:14:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:41858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIWQO7 (ORCPT ); Wed, 23 Sep 2020 12:14:59 -0400 Received: from e123331-lin.nice.arm.com (lfbn-nic-1-188-42.w2-15.abo.wanadoo.fr [2.15.37.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5670821BE5; Wed, 23 Sep 2020 16:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877698; bh=jBPk9GYHchZOkBmUWbnB7ym+PkKvrGJQed6G/FmGfrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuM1FobYpIunjTJWK7dJWn7EA8cdsFf5/ToAAbijFKdjNakRdxWeL4mTR+wXlsuUf fVGGrIhGWDrgqMTlDUiFU/iYve4rn5NadeaJs3lGkCrZHHLpMVBJeF3hkaW10Zohc7 v7dSEaFotzXO7PYfNbi5maeaCKYCqVZ7T7fZ3Bcs= From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Matthew Garrett , Peter Jones , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Subject: [PATCH 1/7] efi: pstore: disentangle from deprecated efivars module Date: Wed, 23 Sep 2020 18:13:58 +0200 Message-Id: <20200923161404.17811-2-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923161404.17811-1-ardb@kernel.org> References: <20200923161404.17811-1-ardb@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The EFI pstore implementation relies on the 'efivars' abstraction, which encapsulates the EFI variable store in a way that can be overridden by other backing stores, like the Google SMI one. On top of that, the EFI pstore implementation also relies on the efivars.ko module, which is a separate layer built on top of the 'efivars' abstraction that exposes the [deprecated] sysfs entries for each variable that exists in the backing store. Since the efivars.ko module is deprecated, and all users appear to have moved to the efivarfs file system instead, let's prepare for its removal, by removing EFI pstore's dependency on it. Signed-off-by: Ard Biesheuvel Acked-by: Kees Cook --- drivers/firmware/efi/Kconfig | 2 +- drivers/firmware/efi/efi-pstore.c | 76 ++++++++++++++++++-- drivers/firmware/efi/efivars.c | 41 +---------- include/linux/efi.h | 4 -- 4 files changed, 74 insertions(+), 49 deletions(-) diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig index 3939699e62fe..dd8d10817bdf 100644 --- a/drivers/firmware/efi/Kconfig +++ b/drivers/firmware/efi/Kconfig @@ -26,7 +26,7 @@ config EFI_ESRT config EFI_VARS_PSTORE tristate "Register efivars backend for pstore" - depends on EFI_VARS && PSTORE + depends on PSTORE default y help Say Y here to enable use efivars as a backend to pstore. This diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index feb7fe6f2da7..785f5e6b3a41 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -8,6 +8,8 @@ #define DUMP_NAME_LEN 66 +#define EFIVARS_DATA_SIZE_MAX 1024 + static bool efivars_pstore_disable = IS_ENABLED(CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE); @@ -18,6 +20,8 @@ module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644); EFI_VARIABLE_BOOTSERVICE_ACCESS | \ EFI_VARIABLE_RUNTIME_ACCESS) +static LIST_HEAD(efi_pstore_list); + static int efi_pstore_open(struct pstore_info *psi) { psi->data = NULL; @@ -126,7 +130,7 @@ static inline int __efi_pstore_scan_sysfs_exit(struct efivar_entry *entry, if (entry->deleting) { list_del(&entry->list); efivar_entry_iter_end(); - efivar_unregister(entry); + kfree(entry); if (efivar_entry_iter_begin()) return -EINTR; } else if (turn_off_scanning) @@ -169,7 +173,7 @@ static int efi_pstore_sysfs_entry_iter(struct pstore_record *record) { struct efivar_entry **pos = (struct efivar_entry **)&record->psi->data; struct efivar_entry *entry, *n; - struct list_head *head = &efivar_sysfs_list; + struct list_head *head = &efi_pstore_list; int size = 0; int ret; @@ -314,12 +318,12 @@ static int efi_pstore_erase_name(const char *name) if (efivar_entry_iter_begin()) return -EINTR; - found = __efivar_entry_iter(efi_pstore_erase_func, &efivar_sysfs_list, + found = __efivar_entry_iter(efi_pstore_erase_func, &efi_pstore_list, efi_name, &entry); efivar_entry_iter_end(); if (found && !entry->scanning) - efivar_unregister(entry); + kfree(entry); return found ? 0 : -ENOENT; } @@ -354,14 +358,76 @@ static struct pstore_info efi_pstore_info = { .erase = efi_pstore_erase, }; +static int efi_pstore_callback(efi_char16_t *name, efi_guid_t vendor, + unsigned long name_size, void *data) +{ + struct efivar_entry *entry; + int ret; + + entry = kzalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) + return -ENOMEM; + + memcpy(entry->var.VariableName, name, name_size); + entry->var.VendorGuid = vendor; + + ret = efivar_entry_add(entry, &efi_pstore_list); + if (ret) + kfree(entry); + + return ret; +} + +static int efi_pstore_update_entry(efi_char16_t *name, efi_guid_t vendor, + unsigned long name_size, void *data) +{ + struct efivar_entry *entry = data; + + if (efivar_entry_find(name, vendor, &efi_pstore_list, false)) + return 0; + + memcpy(entry->var.VariableName, name, name_size); + memcpy(&(entry->var.VendorGuid), &vendor, sizeof(efi_guid_t)); + + return 1; +} + +static void efi_pstore_update_entries(struct work_struct *work) +{ + struct efivar_entry *entry; + int err; + + /* Add new sysfs entries */ + while (1) { + entry = kzalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) + return; + + err = efivar_init(efi_pstore_update_entry, entry, + false, &efi_pstore_list); + if (!err) + break; + + efivar_entry_add(entry, &efi_pstore_list); + } + + kfree(entry); +} + static __init int efivars_pstore_init(void) { + int ret; + if (!efivars_kobject() || !efivar_supports_writes()) return 0; if (efivars_pstore_disable) return 0; + ret = efivar_init(efi_pstore_callback, NULL, true, &efi_pstore_list); + if (ret) + return ret; + efi_pstore_info.buf = kmalloc(4096, GFP_KERNEL); if (!efi_pstore_info.buf) return -ENOMEM; @@ -374,6 +440,8 @@ static __init int efivars_pstore_init(void) efi_pstore_info.bufsize = 0; } + INIT_WORK(&efivar_work, efi_pstore_update_entries); + return 0; } diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index dcea137142b3..f39321dbc29f 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c @@ -24,8 +24,7 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(EFIVARS_VERSION); MODULE_ALIAS("platform:efivars"); -LIST_HEAD(efivar_sysfs_list); -EXPORT_SYMBOL_GPL(efivar_sysfs_list); +static LIST_HEAD(efivar_sysfs_list); static struct kset *efivars_kset; @@ -591,42 +590,6 @@ create_efivars_bin_attributes(void) return error; } -static int efivar_update_sysfs_entry(efi_char16_t *name, efi_guid_t vendor, - unsigned long name_size, void *data) -{ - struct efivar_entry *entry = data; - - if (efivar_entry_find(name, vendor, &efivar_sysfs_list, false)) - return 0; - - memcpy(entry->var.VariableName, name, name_size); - memcpy(&(entry->var.VendorGuid), &vendor, sizeof(efi_guid_t)); - - return 1; -} - -static void efivar_update_sysfs_entries(struct work_struct *work) -{ - struct efivar_entry *entry; - int err; - - /* Add new sysfs entries */ - while (1) { - entry = kzalloc(sizeof(*entry), GFP_KERNEL); - if (!entry) - return; - - err = efivar_init(efivar_update_sysfs_entry, entry, - false, &efivar_sysfs_list); - if (!err) - break; - - efivar_create_sysfs_entry(entry); - } - - kfree(entry); -} - static int efivars_sysfs_callback(efi_char16_t *name, efi_guid_t vendor, unsigned long name_size, void *data) { @@ -701,8 +664,6 @@ int efivars_sysfs_init(void) return error; } - INIT_WORK(&efivar_work, efivar_update_sysfs_entries); - return 0; } EXPORT_SYMBOL_GPL(efivars_sysfs_init); diff --git a/include/linux/efi.h b/include/linux/efi.h index 73db1ae04cef..a470256f5ee3 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -984,8 +984,6 @@ struct efivar_entry { bool deleting; }; -extern struct list_head efivar_sysfs_list; - static inline void efivar_unregister(struct efivar_entry *var) { @@ -1043,8 +1041,6 @@ void efivar_run_worker(void); #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) int efivars_sysfs_init(void); -#define EFIVARS_DATA_SIZE_MAX 1024 - #endif /* CONFIG_EFI_VARS */ extern bool efi_capsule_pending(int *reset_type); From patchwork Wed Sep 23 16:14:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 254204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90FB5C4727D for ; Wed, 23 Sep 2020 16:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4290F21BE5 for ; Wed, 23 Sep 2020 16:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877729; bh=zH8OvFJ+fXzumd6pJoYf17znejCcgokbBvxOXA2Qu6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Brex0Sq+OAifFrtVm2gjVKUxmDexTDLKbpAxYNuSWAeFukT305mVO3ryzoYbp0Cv1 RUOOj+IhFyRVH9XfgJjSNMoHN2Z+AHlpU/K1XZ7hBVsW3rE4+8SXkkDRbdMAypOt/9 ZTnLzKC+sSpCLbQGslW12Y5cv9e7SBb+p7L1rEjg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726826AbgIWQPL (ORCPT ); Wed, 23 Sep 2020 12:15:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:42008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgIWQPD (ORCPT ); Wed, 23 Sep 2020 12:15:03 -0400 Received: from e123331-lin.nice.arm.com (lfbn-nic-1-188-42.w2-15.abo.wanadoo.fr [2.15.37.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D20CA208E4; Wed, 23 Sep 2020 16:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877702; bh=zH8OvFJ+fXzumd6pJoYf17znejCcgokbBvxOXA2Qu6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJs2SHH2GjcCxCBHHBwNf4JfP7EA6WiHfspmHY5goymDdEmNvF3dP+ckTa8LwWtTo +EloX/RvBlwx+5glhDKHTl24r5yfq3o15eJoqWnuDlGDrl6bOMeYlEZDDauV5c4+p7 PXyyRFOLxTNBCi7g/7YF2vyesYxma3T7kZ+3pd5U= From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Matthew Garrett , Peter Jones , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Subject: [PATCH 3/7] efi: efivars: un-export efivars_sysfs_init() Date: Wed, 23 Sep 2020 18:14:00 +0200 Message-Id: <20200923161404.17811-4-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923161404.17811-1-ardb@kernel.org> References: <20200923161404.17811-1-ardb@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org efivars_sysfs_init() is only used locally in the source file that defines it, so make it static and unexport it. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efivars.c | 3 +-- include/linux/efi.h | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index f39321dbc29f..a76f50e15e6d 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c @@ -638,7 +638,7 @@ static void efivars_sysfs_exit(void) kset_unregister(efivars_kset); } -int efivars_sysfs_init(void) +static int efivars_sysfs_init(void) { struct kobject *parent_kobj = efivars_kobject(); int error = 0; @@ -666,7 +666,6 @@ int efivars_sysfs_init(void) return 0; } -EXPORT_SYMBOL_GPL(efivars_sysfs_init); module_init(efivars_sysfs_init); module_exit(efivars_sysfs_exit); diff --git a/include/linux/efi.h b/include/linux/efi.h index 8ae64c2a384b..7defdc456dc0 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -1035,10 +1035,6 @@ bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data, bool efivar_variable_is_removable(efi_guid_t vendor, const char *name, size_t len); -#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) -int efivars_sysfs_init(void); - -#endif /* CONFIG_EFI_VARS */ extern bool efi_capsule_pending(int *reset_type); extern int efi_capsule_supported(efi_guid_t guid, u32 flags, From patchwork Wed Sep 23 16:14:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 254205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50A3EC2D0A8 for ; Wed, 23 Sep 2020 16:15:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FBF8208E4 for ; Wed, 23 Sep 2020 16:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877711; bh=HORO4TYQh0n5xyJmt9DuvWW1jd+OsLPkVApF2GDMtMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pPZUi9tparzJIUJkBZMaoW0bV7m7TRTPI5l5b/1tqft+pvnBYSaDylrUMCm38TjPS c09Rkz1Hj2Ye2uFuVCgh5x1rvP1NC68rI8hetNQIqBofx3P2e6so/eAue7LPr/yrut 3CA6u9D2jQ2FApW4for/6rwINzGpma2PRkMOOSGs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbgIWQPK (ORCPT ); Wed, 23 Sep 2020 12:15:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:42116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbgIWQPH (ORCPT ); Wed, 23 Sep 2020 12:15:07 -0400 Received: from e123331-lin.nice.arm.com (lfbn-nic-1-188-42.w2-15.abo.wanadoo.fr [2.15.37.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F8B520936; Wed, 23 Sep 2020 16:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877707; bh=HORO4TYQh0n5xyJmt9DuvWW1jd+OsLPkVApF2GDMtMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s+JX9BZmY3oa4Efk4QNgu/1Y0UsFiXoR2rxIgMwvrG83RSBLLrghnTVwu3Y6Ml1E7 hLGz+myix28LLB6TXIwThXuPtKY2JSBoKCq04ZQnQoY/2e0UAAY2Npk0GhQp4QBRTa TWMBm0AUVztwNwYVgmJJ/oMq2NkRU8VIEGbSHIGI= From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Matthew Garrett , Peter Jones , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Subject: [PATCH 5/7] efi: remove some false dependencies on CONFIG_EFI_VARS Date: Wed, 23 Sep 2020 18:14:02 +0200 Message-Id: <20200923161404.17811-6-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923161404.17811-1-ardb@kernel.org> References: <20200923161404.17811-1-ardb@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Remove some false dependencies on CONFIG_EFI_VARS, which only controls the creation of the sysfs entries, whereas the underlying functionality that these modules rely on is enabled unconditionally when CONFIG_EFI is set. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig index dd8d10817bdf..80f5c67e3638 100644 --- a/drivers/firmware/efi/Kconfig +++ b/drivers/firmware/efi/Kconfig @@ -137,7 +137,6 @@ config EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER config EFI_BOOTLOADER_CONTROL tristate "EFI Bootloader Control" - depends on EFI_VARS default n help This module installs a reboot hook, such that if reboot() is @@ -281,7 +280,7 @@ config EFI_EARLYCON config EFI_CUSTOM_SSDT_OVERLAYS bool "Load custom ACPI SSDT overlay from an EFI variable" - depends on EFI_VARS && ACPI + depends on EFI && ACPI default ACPI_TABLE_UPGRADE help Allow loading of an ACPI SSDT overlay from an EFI variable specified From patchwork Wed Sep 23 16:14:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 254203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5820DC2D0A8 for ; Wed, 23 Sep 2020 16:15:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09FA92223E for ; Wed, 23 Sep 2020 16:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877731; bh=H9yseVXOZkuxMQi1C3SGB2Eins76vUkEAUkZJZSniHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wbYVoEQ+v35aGseRIMyKzkPUWxrb7/hwhO+jAqI8i2i/ISHCXsfudiSC4zkiGQq1l BKW4d33IuB1/Uru5B3Lj4LkkwOMDD3HCXPGiDpBXLwc5+Ju9Ii7xtv4k9iXINo4Fu2 ilBK+HL7UzxD16hGdG6r2u9aReJyBxcmegTyoZ9g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726817AbgIWQPL (ORCPT ); Wed, 23 Sep 2020 12:15:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:42152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726796AbgIWQPJ (ORCPT ); Wed, 23 Sep 2020 12:15:09 -0400 Received: from e123331-lin.nice.arm.com (lfbn-nic-1-188-42.w2-15.abo.wanadoo.fr [2.15.37.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D11D2223E; Wed, 23 Sep 2020 16:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600877709; bh=H9yseVXOZkuxMQi1C3SGB2Eins76vUkEAUkZJZSniHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGWTzRnt6gX0XYyOGVoX7Sfz/L+1nWkp9PKH/BC0bwS4Yrg+Oej+pxxj4UWzAgK/C ukCjyt6rDvLPfcagqb9MkLfc6XPsTTUOjmhxew1/6Xi3Kti1j56+OKmnlikBt/i+B/ zkg+OZ8IZTN6f5kpfeuLF1jc4x0Hm65xvMJcAuZc= From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , Matthew Garrett , Peter Jones , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Subject: [PATCH 6/7] efi: efivars: limit availability to X86 builds Date: Wed, 23 Sep 2020 18:14:03 +0200 Message-Id: <20200923161404.17811-7-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923161404.17811-1-ardb@kernel.org> References: <20200923161404.17811-1-ardb@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org CONFIG_EFI_VARS controls the code that exposes EFI variables via sysfs entries, which was deprecated before support for non-Intel architectures was added to EFI. So let's limit its availability to Intel architectures for the time being, and hopefully remove it entirely in the not too distant future. Signed-off-by: Ard Biesheuvel --- Documentation/arm/uefi.rst | 2 +- drivers/firmware/efi/Kconfig | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Documentation/arm/uefi.rst b/Documentation/arm/uefi.rst index f868330df6be..f732f957421f 100644 --- a/Documentation/arm/uefi.rst +++ b/Documentation/arm/uefi.rst @@ -23,7 +23,7 @@ makes it possible for the kernel to support additional features: For actually enabling [U]EFI support, enable: - CONFIG_EFI=y -- CONFIG_EFI_VARS=y or m +- CONFIG_EFIVAR_FS=y or m The implementation depends on receiving information about the UEFI environment in a Flattened Device Tree (FDT) - so is only available with CONFIG_OF. diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig index 80f5c67e3638..da1887f72a51 100644 --- a/drivers/firmware/efi/Kconfig +++ b/drivers/firmware/efi/Kconfig @@ -4,20 +4,15 @@ menu "EFI (Extensible Firmware Interface) Support" config EFI_VARS tristate "EFI Variable Support via sysfs" - depends on EFI + depends on EFI && (X86 || IA64) default n help If you say Y here, you are able to get EFI (Extensible Firmware Interface) variable information via sysfs. You may read, write, create, and destroy EFI variables through this interface. - - Note that using this driver in concert with efibootmgr requires - at least test release version 0.5.0-test3 or later, which is - available from: - - - Subsequent efibootmgr releases may be found at: - + Note that this driver is only retained for compatibility with + legacy users: new users should use the efivarfs filesystem + instead. config EFI_ESRT bool