From patchwork Tue Jan 30 18:36:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 194265 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1421190dyb; Tue, 30 Jan 2024 10:37:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMLiZ3g0vUTn4m8X/0cuXBSsz//T2eu/ebrK8oKnzgqK2UxJqkgPTX9BowuXO9WORuy+Fd X-Received: by 2002:a17:902:a505:b0:1d9:1df6:6e23 with SMTP id s5-20020a170902a50500b001d91df66e23mr894320plq.39.1706639837456; Tue, 30 Jan 2024 10:37:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706639837; cv=pass; d=google.com; s=arc-20160816; b=PrYuQy2zg8xrrvonokCu/KsqHNhdFmlL0jiZkFjt8L3wzE9RvZvj/oJNTWZrK/51rd Lgi8wAHDpRSIO00iR/UU/3IXDPdg4EWxeelYj6qMrTAXDfusIAmDW7BCWPmmdX4vSGVC OUlbxxmld6rfpdjP6LToDfaIsla2au8zIWeIalasem+TBQxMx0jsOi9be1DBDqvzvXX3 B/33desBpeBbGZxnoekazfWVTaP2MY8oUHqz3zR3dVRNsJAG7+dsMtDjEDdv3nU/+GwO /lg3cPGyeaq/r9pa2QLQ/L0hzgJmg3B1Dmt86ttIc/N8or3hAjLN+/HqnyROJyYhjdLN 2mvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=ktXC4Tu4W/PI2o1wNKexythDSeKUb+mJhHwcTcpw7PM=; fh=Zae8cKprCakNRQPqjfyetrGrVHocMNyGPJxWktRt3nA=; b=odhuSJV/tmsRow91LnnXK141QO7NmM6cj6VsQJhSo+8rfdDQULNYI0EyO0E/br2W0k I5ZGwCe8Shf6rd8DVaHThv/Qncd++VSfxun3OcZSjilDxxm6+cZ0krJTCAJAudec7+zs ic+yCldHEbzupNL1cuzUhVFPG0jAkcg2szcU6cXrPDinBKrbiv4clvMr9fODyro0NyyX HxQ99OvRbv5hCFte9G0lvnOaBUZsME/l6BG8GoOtILYaeQWffjHXObnVZ9G1RBMWrOm1 xnrlOMBcuKhszF+1UPzRNPYv8W/GEydogqsASJQBndBKq3K7hWs7XPE0h0hvpIcuC41Z v8Rg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RiQrgwd1; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45120-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45120-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ju4-20020a170903428400b001d8dbd0bb32si3968720plb.13.2024.01.30.10.37.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 10:37:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45120-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RiQrgwd1; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45120-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45120-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 111D1281154 for ; Tue, 30 Jan 2024 18:37:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9369D78B59; Tue, 30 Jan 2024 18:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RiQrgwd1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="9cL7vkI3" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 435F178B4B; Tue, 30 Jan 2024 18:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706639795; cv=none; b=Op74YA8lonpHSKm1KSil+cuHl5ChpLIsH2qXYzTIXnAGAOdpiB2PrjyclLLSiuM85UUUBF26MxPyDkbm+NkyMKYTHrKNIUVli4QYH/uX5fAgVlbtPxYjbhu/YWVj0aJSw96Vq7nB7WKSfSJ8DAFHYAnrr0lnML/6OYswizbFzb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706639795; c=relaxed/simple; bh=cA5Zn5/WMws58Qtz6JIub0Jb5+CjAaFY21Nf3/33IwE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=RJUtalMng1FXV9QFqHdXYRf2H7InWI5qtVadpEXB4lNLcT3X08iuzQgsrAC3X46h/CKnp7lGGJshHY31gt3/VwplkhRYJqmrhdm1X8EfeCsKPYTAVuwk7XhBr8cdP8xfp/DMTr7gb2hPH8UDb1ZHE9vqXT/oytbiwII4aBNeaoQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RiQrgwd1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=9cL7vkI3; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 30 Jan 2024 18:36:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706639792; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ktXC4Tu4W/PI2o1wNKexythDSeKUb+mJhHwcTcpw7PM=; b=RiQrgwd10ALmpLA4fIu+swhm8HGByb5Ye4aOMpNbTcIaVvJEEhNKT+o4JpAGSAdM/GcAYJ IAr3Bus93v60R0Puk7XClSDV3qll/UOEafxkNCIwp2Lka6R7mYLYWO7R4ANUqmNcU5JW47 G5fBQqUN5v2pdRYgiDxLgxlrMcIlzNhXgb1IraJZZHxGexBK4ZKyAF9PZm7ddzTCIIs12q T6kpAdKRvlTej9XfU6f9w7RmgjIUPdFx/NLoImUCPLoxUXl31Q1iBTIo/bYo3ac+csNIP0 +M6iWHmiaulng7Uxb0tyEzAy9w7bnFxVswYTez5oOo1XKUkN4+wIk2nhQ/FyUA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706639792; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ktXC4Tu4W/PI2o1wNKexythDSeKUb+mJhHwcTcpw7PM=; b=9cL7vkI30um2/OJ+IjRdYfmnr9Fru6hMxY2iSi8es2T5Ynq+KnOSKKtDYt+KgxfXMZufz1 JizSW+6nshmALEAA== From: "tip-bot2 for Thomas Zimmermann" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/build] x86/efi: Implement arch_ima_efi_boot_mode() in source file Cc: Ard Biesheuvel , Thomas Zimmermann , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240112095000.8952-4-tzimmermann@suse.de> References: <20240112095000.8952-4-tzimmermann@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170663979187.398.3170118854005669182.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789541574346998151 X-GMAIL-MSGID: 1789541574346998151 The following commit has been merged into the x86/build branch of tip: Commit-ID: 785ddc8b6bebd958a5b6fb7b6b4aa6584c2f0cb2 Gitweb: https://git.kernel.org/tip/785ddc8b6bebd958a5b6fb7b6b4aa6584c2f0cb2 Author: Thomas Zimmermann AuthorDate: Fri, 12 Jan 2024 10:44:38 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jan 2024 15:17:17 +01:00 x86/efi: Implement arch_ima_efi_boot_mode() in source file The x86 implementation of arch_ima_efi_boot_mode() uses the global boot_param state. Move it into a source file to clean up the header. Avoid potential rebuilds of unrelated source files if boot_params changes. Suggested-by: Ard Biesheuvel Signed-off-by: Thomas Zimmermann Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20240112095000.8952-4-tzimmermann@suse.de --- arch/x86/include/asm/efi.h | 5 +++-- arch/x86/platform/efi/efi.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index a5d7a83..1dc600f 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -409,8 +409,9 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md, extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, void *buf, struct efi_mem_range *mem); -#define arch_ima_efi_boot_mode \ - ({ extern struct boot_params boot_params; boot_params.secure_boot; }) +extern enum efi_secureboot_mode __x86_ima_efi_boot_mode(void); + +#define arch_ima_efi_boot_mode __x86_ima_efi_boot_mode() #ifdef CONFIG_EFI_RUNTIME_MAP int efi_get_runtime_map_size(void); diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index e9f99c5..f090ec9 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -950,3 +950,8 @@ umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) } return attr->mode; } + +enum efi_secureboot_mode __x86_ima_efi_boot_mode(void) +{ + return boot_params.secure_boot; +}