Received: by 2002:ac8:4f8f:0:b0:429:955e:b7c6 with SMTP id j15csp7707qtw; Tue, 16 Jan 2024 13:06:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6b4HHrjCLg6/8eELGGryfKxK6/+jrOgKiSrrqwpOKCYTPwX+HzgkMI7ugF5r3bVmC+5uS X-Received: by 2002:aa7:9a44:0:b0:6db:4b64:481c with SMTP id x4-20020aa79a44000000b006db4b64481cmr9366668pfj.24.1705439199855; Tue, 16 Jan 2024 13:06:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705439199; cv=pass; d=google.com; s=arc-20160816; b=WUax/0yOt0zQ32uyTGDrZon1xayIHq1Bka3j8oaBfxvcNKVJ0O+YpN8WvQZGHVUTDD aR8UFoGkPQx+4XCKYfubZLpMzW0zwTaa3+LupjOLm494MqIBnFpYv22lfuw/GiYDj1E0 SB9OGkh79Th0qAKd4KtEj31ygW/3YtlBEWrBbECe2qR49bc7JOgaNPvMvd3GchDKxwli sjKnJHNh6MAFp9QUkanhSxlsOq26mW11t8IV6myJLljQq3HNfjrbcDPIltLOP2LhXYlf AFB57lhmgLakgbhP3cd0clLvBkn3tVT/LWVNlwZMak+ecPV7l1eqV/ir4D/U3zBYwfQ1 7Thg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pOfsJaIpjHWLF5LIB1pUZeW5VXos8P+4tvSebVWRmp0=; fh=h8iDwrNj5fXhOXpRRR4kWKtVIiMXm5So5+GAVTLy1Wk=; b=FuuZWdaRRVC5BLRpvfiPYXvmXe2uyF+NRPDTOJFiDue1cohSs3p4v02xbz2ToFSGyY 2XAa7a/AaJgbKCDQVkLHDsl9OWObMJl3xUGu3EaZYic4eLEV80T8noZSJTRiZaR7IERH qatZ5BkHCvAgh5vrDAMCu+L7MYsdJuQALHj6/xUVwkIjqYzgI0nPO7hErHuSRqWCJiyQ zunOlOxLZumxxRVbEmWCFPX+9h6o7islJCiSkTu5jI9nvvfizx6I5GnR6X7iOWvg5bJl gh+RqVxL5jBYnkdD3MVVFWpbQsdRvRL81p3r1Xji4lFdDb7u8pctBEL855llrt9Mh/pI xk5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BhGz9CZU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-27993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y193-20020a638aca000000b005ce26bfea7csi11493247pgd.529.2024.01.16.13.06.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 13:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BhGz9CZU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-27993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0ACCBB27400 for ; Tue, 16 Jan 2024 20:53:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89FED5BACF; Tue, 16 Jan 2024 19:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BhGz9CZU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AF8D55BAC4; Tue, 16 Jan 2024 19:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434797; cv=none; b=HJVYKhn+T46wzVFyTQminmYl5BCLIe6Bux9ELhMuLO8txwcYTgtM/+BMGpkNvIHSN5Px19++TvVx99T7BxDJncubw2Ktk8VCbrrz7P7gKwWKWrOCb5jOk7HX3ibJmlx5plYhfSp5KXFDlkJPAh8bCva64T9Meytpbwd4xu4g6z8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434797; c=relaxed/simple; bh=nFwiyKpVMtwCLdn+g9bVyJk7PIg5t850sOdqgjHgcpk=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:X-stable: X-Patchwork-Hint:X-stable-base:Content-Transfer-Encoding; b=a7k6J17HRBBnILLyQm+iBsWBoo/Cdep1AhXRMyuZOanJh799PpANAi7THcY67IHo2b80Yg+jMYhWdhsac0Fl8JNV135kdfU3Z+nNVx/aLzmgHy/QW/9b9TUN2x5SRtQo8PXfLV08BZMH7lhuMoqKTMhUAA+2deBh+261Qnaofb8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BhGz9CZU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22EBFC433F1; Tue, 16 Jan 2024 19:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705434797; bh=nFwiyKpVMtwCLdn+g9bVyJk7PIg5t850sOdqgjHgcpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhGz9CZUI8vuwQKuSKujt/33CseBqZsdtp6vxmgFzN1nGnq680+23w87UNWQiAKdw hf7Lton/IrFGzWuhKfEBKNnp5Fah+MKSqHMZNmZilRDTCkjoKJ2nfL7VAqWNOaYYK3 +C/xcAEW5s7qVJvv4wTLIsTYD68ZA3bs76W1wHsB3ujyNhjBqAYNo/UgKOJNUnk7IJ FM/hr2ylciohlJ7qY51flXvCpIAM9kI11aIT6momK+QGdZDKxYLbnhQZfgI6rCPuoK 3NYkfw3s9yYH6xLC9ZEeMnDe+3m1RcXOBnQ79nG6Z9mO6r084DvixRIc53rOPmRRT6 IIVJxg0WW/5sg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Peter Zijlstra , Alexei Starovoitov , Sasha Levin , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, samitolvanen@google.com, keescook@chromium.org, llvm@lists.linux.dev Subject: [PATCH AUTOSEL 6.6 081/104] cfi: Add CFI_NOSEAL() Date: Tue, 16 Jan 2024 14:46:47 -0500 Message-ID: <20240116194908.253437-81-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116194908.253437-1-sashal@kernel.org> References: <20240116194908.253437-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.12 Content-Transfer-Encoding: 8bit From: Peter Zijlstra [ Upstream commit e9d13b9d2f99ccf7afeab490d97eaa5ac9846598 ] Add a CFI_NOSEAL() helper to mark functions that need to retain their CFI information, despite not otherwise leaking their address. Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20231215092707.669401084@infradead.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- arch/x86/include/asm/cfi.h | 5 +++++ include/linux/cfi.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h index 58dacd90daef..67b010c224e4 100644 --- a/arch/x86/include/asm/cfi.h +++ b/arch/x86/include/asm/cfi.h @@ -9,6 +9,7 @@ */ #include +#include #ifdef CONFIG_CFI_CLANG enum bug_trap_type handle_cfi_failure(struct pt_regs *regs); @@ -19,4 +20,8 @@ static inline enum bug_trap_type handle_cfi_failure(struct pt_regs *regs) } #endif /* CONFIG_CFI_CLANG */ +#if HAS_KERNEL_IBT == 1 +#define CFI_NOSEAL(x) asm(IBT_NOSEAL(__stringify(x))) +#endif + #endif /* _ASM_X86_CFI_H */ diff --git a/include/linux/cfi.h b/include/linux/cfi.h index 3552ec82b725..bb084eb053e7 100644 --- a/include/linux/cfi.h +++ b/include/linux/cfi.h @@ -38,4 +38,8 @@ static inline void module_cfi_finalize(const Elf_Ehdr *hdr, #endif /* CONFIG_ARCH_USES_CFI_TRAPS */ #endif /* CONFIG_MODULES */ +#ifndef CFI_NOSEAL +#define CFI_NOSEAL(x) +#endif + #endif /* _LINUX_CFI_H */ -- 2.43.0