From patchwork Sun May 4 14:20:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Ard Biesheuvel X-Patchwork-Id: 887894 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 97E9A19CC3D; Sun, 4 May 2025 14:20:18 +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=1746368420; cv=none; b=V3Rbqef1wpAStF5aumXwSSHsce1Cwb00gGeU5Ntyks6NmcdkjDUiF86OEAt6peWiYOQfX4kMvk/PaF1q6hu68C6NuYp+vAD2OTxwwAdbrMrwnbldemrtdxVUto7Yg8VjgNzWmtcN3dkImzfEB5wTWyNT363mSmfB45zkBi5BsPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746368420; c=relaxed/simple; bh=DpzwIdbxQVJNaQb1u9aYhMrmwm09UasnI8BwV+/kocU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=IFObfN8sdUmnl0C7Mj9PfdzoOH7DkgoAhIvP2Yw0WMFEBZpwuFPfDG6Q3TcqXz0STAeHYDv6iN+IB+F/zHE0F4EGaeQSBBaDpIwpuGZja6cCFDISUxpJVIMNK7TufxrDycQEkbXy8l32MxwnE8WvH3pupayDBj6UdMiBohy/41Y= 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=kGbzYxbG; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1Yvcautk; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kGbzYxbG"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1Yvcautk" Date: Sun, 04 May 2025 14:20:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1746368416; 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=DRgdnpRkLNVpgGrZBUxe1q6YDHH5fAXqhv6jdJxiXPA=; b=kGbzYxbGj1iHXrRdKUVSA3DMV+bWGyJ69uNILnGLQ6Q2EmBzxkCG06V7fKkoXJFIGia9wk tBOvWH0LvneGCRdUMJKIbkUIxYK/6mjUXJ9IvYBtE6nOtcOXDM29r4Ry4wzBrUdpb4j/8f gSsb4TlVeLYRWkc48aWNdHtwmYZs4J08Bk7jHeVv8E7jQrCmf7CN04SNxvWo7MEEmER8vo 273PAu7RxELFlOvoCKgYCBTLKjVjt39QHyrH2+zqJG7Wq2YdxE61fFBWMHU6FefNE1/po9 UT4pBdYZ0O+1/HKvyW2j5kH5Z1lbQxJ6dOWkL/T/9wX8y4CWFglo3m9cmEAeKg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1746368416; 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=DRgdnpRkLNVpgGrZBUxe1q6YDHH5fAXqhv6jdJxiXPA=; b=1YvcautkyWoYQDDU3UdlGRsBKi/6kofmvjQrDfehOQodKR/2AAxv2CWy2dwpiRy4O4xpof OyQfsPw71IUDrgAQ== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/linkage: Add SYM_PIC_ALIAS() macro helper to emit symbol aliases Cc: Ard Biesheuvel , Ingo Molnar , Arnd Bergmann , David Woodhouse , Dionna Amalie Glaze , "H. Peter Anvin" , Kees Cook , Kevin Loughlin , Len Brown , Linus Torvalds , "Rafael J. Wysocki" , Tom Lendacky , linux-efi@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250504095230.2932860-38-ardb+git@google.com> References: <20250504095230.2932860-38-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174636841571.22196.12713984367878648321.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk The following commit has been merged into the x86/boot branch of tip: Commit-ID: f932adcc8650eb169efd0fd19f2a450c260d306c Gitweb: https://git.kernel.org/tip/f932adcc8650eb169efd0fd19f2a450c260d306c Author: Ard Biesheuvel AuthorDate: Sun, 04 May 2025 11:52:43 +02:00 Committer: Ingo Molnar CommitterDate: Sun, 04 May 2025 15:59:43 +02:00 x86/linkage: Add SYM_PIC_ALIAS() macro helper to emit symbol aliases Startup code that may execute from the early 1:1 mapping of memory will be confined into its own address space, and only be permitted to access ordinary kernel symbols if this is known to be safe. Introduce a macro helper SYM_PIC_ALIAS() that emits a __pi_ prefixed alias for a symbol, which allows startup code to access it. Signed-off-by: Ard Biesheuvel Signed-off-by: Ingo Molnar Cc: Arnd Bergmann Cc: David Woodhouse Cc: Dionna Amalie Glaze Cc: H. Peter Anvin Cc: Kees Cook Cc: Kevin Loughlin Cc: Len Brown Cc: Linus Torvalds Cc: Rafael J. Wysocki Cc: Tom Lendacky Cc: linux-efi@vger.kernel.org Link: https://lore.kernel.org/r/20250504095230.2932860-38-ardb+git@google.com --- arch/x86/include/asm/linkage.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h index b51d8a4..9d38ae7 100644 --- a/arch/x86/include/asm/linkage.h +++ b/arch/x86/include/asm/linkage.h @@ -141,5 +141,15 @@ #define SYM_FUNC_START_WEAK_NOALIGN(name) \ SYM_START(name, SYM_L_WEAK, SYM_A_NONE) +/* + * Expose 'sym' to the startup code in arch/x86/boot/startup/, by emitting an + * alias prefixed with __pi_ + */ +#ifdef __ASSEMBLER__ +#define SYM_PIC_ALIAS(sym) SYM_ALIAS(__pi_ ## sym, sym, SYM_L_GLOBAL) +#else +#define SYM_PIC_ALIAS(sym) extern typeof(sym) __PASTE(__pi_, sym) __alias(sym) +#endif + #endif /* _ASM_X86_LINKAGE_H */