From nobody Fri Dec 19 12:44:57 2025 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 1D7C72DF12F for ; Sat, 6 Dec 2025 21:42:04 +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=1765057326; cv=none; b=Ti8kBYveB3WDdwQfaVrGki5a1jT/YEE8X4fwEecNy2Pzjy1METgLCwz2Phq7o/upxCa6CaBqwSD/ClhJFyWJZ/8+S1VcHC9hYqGCdJzEHdgjWNI3RJDNaR7S1mOeBGfxLutFA92ueY++kVcpdDNZbfekQTP8qvY5rKGFdpCFsoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057326; c=relaxed/simple; bh=rx3sS67Yq7DspAm64dUKrB8hVXtz2HCFCQIMRqs0zu8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A8Dnhphj8BYsAG2R+7WclzgvSMVsEIpgGQ+adl9Yj+ymbRjEir9KkZyTS86WU9L8SfpD8VQAi/UJqphI+rpa42+HWi6vHq50OHmzao+CYV5Yv88Dm2Nyr8DD+mcPwPKsIJQx5hldyuQaxTeUwLLgR0mzk4lAdMfveaINaSK5Jvg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MUe2OEPX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MUe2OEPX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8988AC116D0; Sat, 6 Dec 2025 21:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057324; bh=rx3sS67Yq7DspAm64dUKrB8hVXtz2HCFCQIMRqs0zu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUe2OEPXANnRQHbiPfJ6vXPoZBqZUeUwMrPPkk4QOk41jcPN79v12sDgS0wFo+xa8 KDuEfuVlZ6I3ujDI4/FegwtuCYzPWG1lTGJIi19T7AtHigRb+06EF3AS19zWGJBNvA 2aFOZOt//5CsbaAXFSj3fUbgZhRLArN12TD89a8rLnylsSUyuTdgJFcleYhS0GJ0eO 7S3kZf8dkUcjnxHMcIo0lFwTYau6K/Q00BGQTiQxF1t9C8UZXgZZyw49orzTW4femw TJBSY9JgEvvlSL8SH9DUw2fjHYibSQRUZZi1E7yAzYjWQgqA/biDeBqaemPU3w5m4M TjNMaVp9UZNoA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 1/8] objtool: Rename ANNOTYPE_IGNORE_ALTS -> ANNOTYPE_IGNORE_ALTERNATIVE Date: Sat, 6 Dec 2025 13:41:08 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename ANNOTYPE_IGNORE_ALTS to ANNOTYPE_IGNORE_ALTERNATIVE for consistency with its corresponding ANNOTATE_IGNORE_ALTERNATIVE macro. Signed-off-by: Josh Poimboeuf --- include/linux/annotate.h | 4 ++-- include/linux/objtool_types.h | 2 +- tools/include/linux/objtool_types.h | 2 +- tools/objtool/check.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/annotate.h b/include/linux/annotate.h index 2f1599c9e573..929f5c658a1d 100644 --- a/include/linux/annotate.h +++ b/include/linux/annotate.h @@ -75,7 +75,7 @@ * objtool annotation to ignore the alternatives and only consider the ori= ginal * instruction(s). */ -#define ANNOTATE_IGNORE_ALTERNATIVE ASM_ANNOTATE(ANNOTYPE_IGNORE_ALTS) +#define ANNOTATE_IGNORE_ALTERNATIVE ASM_ANNOTATE(ANNOTYPE_IGNORE_ALTERNATI= VE) /* * This macro indicates that the following intra-function call is valid. * Any non-annotated intra-function call will cause objtool to issue a war= ning. @@ -116,7 +116,7 @@ #define ANNOTATE_RETPOLINE_SAFE ANNOTATE type=3DANNOTYPE_RETPOLINE_SAFE /* ANNOTATE_INSTR_BEGIN ANNOTATE type=3DANNOTYPE_INSTR_BEGIN */ /* ANNOTATE_INSTR_END ANNOTATE type=3DANNOTYPE_INSTR_END */ -#define ANNOTATE_IGNORE_ALTERNATIVE ANNOTATE type=3DANNOTYPE_IGNORE_ALTS +#define ANNOTATE_IGNORE_ALTERNATIVE ANNOTATE type=3DANNOTYPE_IGNORE_ALTERN= ATIVE #define ANNOTATE_INTRA_FUNCTION_CALL ANNOTATE type=3DANNOTYPE_INTRA_FUNCTI= ON_CALL #define ANNOTATE_UNRET_BEGIN ANNOTATE type=3DANNOTYPE_UNRET_BEGIN #define ANNOTATE_REACHABLE ANNOTATE type=3DANNOTYPE_REACHABLE diff --git a/include/linux/objtool_types.h b/include/linux/objtool_types.h index c6def4049b1a..e740002018c0 100644 --- a/include/linux/objtool_types.h +++ b/include/linux/objtool_types.h @@ -62,7 +62,7 @@ struct unwind_hint { #define ANNOTYPE_INSTR_BEGIN 3 #define ANNOTYPE_INSTR_END 4 #define ANNOTYPE_UNRET_BEGIN 5 -#define ANNOTYPE_IGNORE_ALTS 6 +#define ANNOTYPE_IGNORE_ALTERNATIVE 6 #define ANNOTYPE_INTRA_FUNCTION_CALL 7 #define ANNOTYPE_REACHABLE 8 #define ANNOTYPE_NOCFI 9 diff --git a/tools/include/linux/objtool_types.h b/tools/include/linux/objt= ool_types.h index c6def4049b1a..e740002018c0 100644 --- a/tools/include/linux/objtool_types.h +++ b/tools/include/linux/objtool_types.h @@ -62,7 +62,7 @@ struct unwind_hint { #define ANNOTYPE_INSTR_BEGIN 3 #define ANNOTYPE_INSTR_END 4 #define ANNOTYPE_UNRET_BEGIN 5 -#define ANNOTYPE_IGNORE_ALTS 6 +#define ANNOTYPE_IGNORE_ALTERNATIVE 6 #define ANNOTYPE_INTRA_FUNCTION_CALL 7 #define ANNOTYPE_REACHABLE 8 #define ANNOTYPE_NOCFI 9 diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3f7999317f4d..53af6887852a 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2358,7 +2358,7 @@ static int __annotate_early(struct objtool_file *file= , int type, struct instruct switch (type) { =20 /* Must be before add_special_section_alts() */ - case ANNOTYPE_IGNORE_ALTS: + case ANNOTYPE_IGNORE_ALTERNATIVE: insn->ignore_alts =3D true; break; =20 @@ -2439,7 +2439,7 @@ static int __annotate_late(struct objtool_file *file,= int type, struct instructi insn->unret =3D 1; break; =20 - case ANNOTYPE_IGNORE_ALTS: + case ANNOTYPE_IGNORE_ALTERNATIVE: /* early */ break; =20 --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 1D6DE2DF125 for ; Sat, 6 Dec 2025 21:42:05 +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=1765057326; cv=none; b=boDHr0ftL9fV5pU8kYKbHs9lRp/g2L+d8zEqAHqIOP+iL3T5YwTxmWXHv7+b93nX8FbmMkmalVoa5GCho0gwIWSCsTM37bAX/pjtp81U6Ngvk3n1/FCdwLbjfi3jlMvk7Fb3RJfTqfoJ9t/rOzkcEW8C25otpx7EEHpuLmmQ2Ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057326; c=relaxed/simple; bh=KCb3t27KTQg9U4SvWb628Zc1/Mud1hf1SxxSl6w+L3E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZCqClWDwzncf6wElkxhDggkNU6sKv50S77Z9XcVVKRhlgDfbKroPOGyp2kYnv8VZgulZ7v9IWXqqyN4wUb3JStCf2HWsj7yghj9mR30F0sSt6XkfVY07hW0lG25mSxdjuNCmzfKZCoxIwyAcnZqQIg+EXgo4lSVwuVNqc/yZ5VU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bDaks2nj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bDaks2nj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE311C4CEF5; Sat, 6 Dec 2025 21:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057325; bh=KCb3t27KTQg9U4SvWb628Zc1/Mud1hf1SxxSl6w+L3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDaks2nj1+gOINtDswesT7SWexYFhrjw+Ka29dedkr8V/lUU7I6dU8yCXmPWFbin6 76PQDbJTKpTMr30DHgQp9Uht4weEyIgRuFekAL4dyG5Nu/qmcpCDFmlgH+mxrAU/Iu jrwhda2O50irweBIyTnsw1eGLzjBauRW4mlOS9W3s1puyE4P9w+A6i8die4mgFDf8G rQswQeqWGn847k7jkvtz8iS++a4VLKI6HZIeB/ROGqcBJgZbUh1p+ZPj9MYAjbpns0 i3TtRf5fgWSNRjI+WTofg1AtRd396a81I87pm4VmoafBMli3H81/RIoIv+uN7pkVpj FcFE7dGg6lsVg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 2/8] objtool: Make ANNOTYPE_DATA_SPECIAL unique across all annotations Date: Sat, 6 Dec 2025 13:41:09 -0800 Message-ID: <8681157420f2ce9cd82b4eda8eeec501bb5b133c.1765044697.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While text annotations and data annotations are placed in separate sections, their underlying format (and creation macros) are the same. Use the same ANNOTYPE value space for both to reduce the possibility of clashes. Signed-off-by: Josh Poimboeuf --- include/linux/objtool_types.h | 3 +-- tools/include/linux/objtool_types.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/objtool_types.h b/include/linux/objtool_types.h index e740002018c0..0b55dc386b69 100644 --- a/include/linux/objtool_types.h +++ b/include/linux/objtool_types.h @@ -66,7 +66,6 @@ struct unwind_hint { #define ANNOTYPE_INTRA_FUNCTION_CALL 7 #define ANNOTYPE_REACHABLE 8 #define ANNOTYPE_NOCFI 9 - -#define ANNOTYPE_DATA_SPECIAL 1 +#define ANNOTYPE_DATA_SPECIAL 10 =20 #endif /* _LINUX_OBJTOOL_TYPES_H */ diff --git a/tools/include/linux/objtool_types.h b/tools/include/linux/objt= ool_types.h index e740002018c0..0b55dc386b69 100644 --- a/tools/include/linux/objtool_types.h +++ b/tools/include/linux/objtool_types.h @@ -66,7 +66,6 @@ struct unwind_hint { #define ANNOTYPE_INTRA_FUNCTION_CALL 7 #define ANNOTYPE_REACHABLE 8 #define ANNOTYPE_NOCFI 9 - -#define ANNOTYPE_DATA_SPECIAL 1 +#define ANNOTYPE_DATA_SPECIAL 10 =20 #endif /* _LINUX_OBJTOOL_TYPES_H */ --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 1D84C2DF138 for ; Sat, 6 Dec 2025 21:42:05 +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=1765057326; cv=none; b=ML16uZ1d/s3HppVYIohcimhsoC70by0zAbzkxWoTziF38wKtAt5rgenOuUdiG87ZRSCe+KwxaGaKJ+xSN1LaGE2vBe2GcZulBdNih9B0WkM6dkzEL/8+9tUR4QU4Nx0fVzHcm2kBvKENZER0LNTNlgel2LV6j4S7uVWby/q0/cI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057326; c=relaxed/simple; bh=BZgBfgaRvNl+NItRjbnd3VlFaLb6VPBUMQst8elTclI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FsnwK/2q70xB8faTMXMQh3udQBYGsKOadqUeNgzyQ+dQDo5purjOqMTFPHnMXnr7ohxe8FK7fQJFqvO/qmZfqYqSGq5+wpTJZnJmwM9UVZh5fCWa26KDXHFHIiDFDpwrBWDqoDmY9b1/4pnRLXCZnMTUViUbqPq8yEFuCy9h2v0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R5lxgTS5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R5lxgTS5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64E04C113D0; Sat, 6 Dec 2025 21:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057325; bh=BZgBfgaRvNl+NItRjbnd3VlFaLb6VPBUMQst8elTclI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R5lxgTS5of/B4jHKnZWg/juzFI0I1BGCPMhJXcvoxeNl6O/ublOZOeEkTiVGZlzUu CjtmmUuq9APt4C3ZLF6tV4FtO0YLGK7PUazHdownQuRZduawzMdOiJaMkFFKz5xr1g hkRsjvDb8KWMW7zbCG/rT112aULHrkFw1prDBn2EbZsAtaTtVYbYgAkVnm1JQ9spXO 7cbhrQLt/5QHGX0fmd4JtOjGjkd3id3kpvBpsAdo2xHU8xwJHtYeNSkHloWX0CuVFx 3rKuSUT21tFsjl1upAw+r2aEjmby4Wjr/rIzvktrIMHWia6dHzME/83U6L3LbtZwoc n/g4KOtXDkAdA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 3/8] objtool: Rename C ANNOTATE_REACHABLE to ANNOTATE_REACHABLE_LABEL Date: Sat, 6 Dec 2025 13:41:10 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Unlike the asm version, the C version of ANNOTATE_REACHABLE takes an argument. Rename it to ANNOTATE_REACHABLE_LABEL accordingly. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/bug.h | 2 +- arch/x86/include/asm/irq_stack.h | 2 +- include/linux/annotate.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index ee23b98353d7..df170c2f1e24 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -125,7 +125,7 @@ do { \ * message out than not know about it. */ =20 -#define ARCH_WARN_REACHABLE ANNOTATE_REACHABLE(1b) +#define ARCH_WARN_REACHABLE ANNOTATE_REACHABLE_LABEL(1b) =20 #define __WARN_FLAGS(cond_str, flags) \ do { \ diff --git a/arch/x86/include/asm/irq_stack.h b/arch/x86/include/asm/irq_st= ack.h index 8325b79f2ac6..af4b10de3f9c 100644 --- a/arch/x86/include/asm/irq_stack.h +++ b/arch/x86/include/asm/irq_stack.h @@ -101,7 +101,7 @@ =20 #define ASM_CALL_ARG0 \ "1: call %c[__func] \n" \ - ANNOTATE_REACHABLE(1b) " \n" + ANNOTATE_REACHABLE_LABEL(1b) " \n" =20 #define ASM_CALL_ARG1 \ "movq %[arg1], %%rdi \n" \ diff --git a/include/linux/annotate.h b/include/linux/annotate.h index 929f5c658a1d..0ece31a9b585 100644 --- a/include/linux/annotate.h +++ b/include/linux/annotate.h @@ -94,7 +94,7 @@ * terminating, like a noreturn CALL or UD2 when we know they are not -- eg * WARN using UD2. */ -#define ANNOTATE_REACHABLE(label) ASM_ANNOTATE_LABEL(label, ANNOTYPE_REACH= ABLE) +#define ANNOTATE_REACHABLE_LABEL(label) ASM_ANNOTATE_LABEL(label, ANNOTYPE= _REACHABLE) /* * This should not be used; it annotates away CFI violations. There are a = few * valid use cases like kexec handover to the next kernel image, and there= is --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 5902F2E1C65 for ; Sat, 6 Dec 2025 21:42:06 +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=1765057327; cv=none; b=H2Rl0WGR1C+3a/E3Mo8MjJJ9ok+ZdyhpqS6lkRZry7e3oXbFE0C/0/caoQyPooerBOb9O6CnKQiSNGq12GITOmsR+oKBvev/n4cmDthtBFxIUITZdeO2tEj+hXAKe+DIm8UX6Lt9SuQyR21iEQxsD1uYDHYPssys/qyPdbYvf7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057327; c=relaxed/simple; bh=dlLUs+jIKhpIGRuYpSDnNyG97Y6Vbta+owwmYJ36q4s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fJcvGxCXOX5A0jao2uAsP8qdBP/f84nUh66Yed5+cQooSjn5xPWhf3Xnmp57Cyn5Z54rr5hjqLbokn1uiC0EqU/ncL8YfjNqpbsWDBELOq7M9RMYp7+SX5j8IqLjZYbEmc+CfKxXSbPnSzdyXffPGBbaN8UvXud5JjAQn4Y4MVI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qljm9Pe4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qljm9Pe4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA61AC19423; Sat, 6 Dec 2025 21:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057326; bh=dlLUs+jIKhpIGRuYpSDnNyG97Y6Vbta+owwmYJ36q4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qljm9Pe4qMVWHzbXQnOv+9fhDrjDobSSIpngx8AaeEOdJlcVG8sxIvqyJBk7V/Slk Uzwzl1FaIaas84hqWN9HXuM+HLO/xW/3aUNRbHzVZuH2zZPTl2ldoaukJYJcZsy1bF Lc2PUeYWb+iRQqUMZMC38/cNgeholCtJlmEXgxiaVOADRlS6cZfjKioFNSgWKMcUXN yOjoO8Rf1/wxu7uBKDQfoJgaMl+k4cq56THp2tBxwsO2Ezqe8icS/EBwQibwWbnqOI 4BvOwWQosEa+NjA8193c1JVHpdbK4uaSuJ93cSyJDz2q+XF26J5uIj5l76CFD0Y7qY uNlsgKmVd68Wg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 4/8] objtool: Rename asm ANNOTATE_NOCFI_SYM to ANNOTATE_NOCFI Date: Sat, 6 Dec 2025 13:41:11 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Unlike the C version, the asm version of ANNOTATE_NOCFI_SYM doesn't take an argument. Rename it to ANNOTATE_NOCFI accordingly. Signed-off-by: Josh Poimboeuf --- arch/x86/platform/efi/efi_stub_64.S | 2 +- include/linux/annotate.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/ef= i_stub_64.S index f0a5fba0717e..5aac37d379ab 100644 --- a/arch/x86/platform/efi/efi_stub_64.S +++ b/arch/x86/platform/efi/efi_stub_64.S @@ -14,7 +14,7 @@ SYM_FUNC_START(__efi_call) /* * The EFI code doesn't have any CFI, annotate away the CFI violation. */ - ANNOTATE_NOCFI_SYM + ANNOTATE_NOCFI pushq %rbp movq %rsp, %rbp and $~0xf, %rsp diff --git a/include/linux/annotate.h b/include/linux/annotate.h index 0ece31a9b585..1678410efa1b 100644 --- a/include/linux/annotate.h +++ b/include/linux/annotate.h @@ -120,7 +120,7 @@ #define ANNOTATE_INTRA_FUNCTION_CALL ANNOTATE type=3DANNOTYPE_INTRA_FUNCTI= ON_CALL #define ANNOTATE_UNRET_BEGIN ANNOTATE type=3DANNOTYPE_UNRET_BEGIN #define ANNOTATE_REACHABLE ANNOTATE type=3DANNOTYPE_REACHABLE -#define ANNOTATE_NOCFI_SYM ANNOTATE type=3DANNOTYPE_NOCFI +#define ANNOTATE_NOCFI ANNOTATE type=3DANNOTYPE_NOCFI #define ANNOTATE_DATA_SPECIAL ANNOTATE_DATA type=3DANNOTYPE_DATA_SPECIAL #endif /* __ASSEMBLY__ */ =20 --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 58A7D2E173B for ; Sat, 6 Dec 2025 21:42:06 +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=1765057327; cv=none; b=hCMg1rmC8kVMlFjMcF4xTCTrHXEH743VioZ1OMNzI9aWLDgeu7Ohza1d0mu27dZLFekVURh2GH2RkU8OSZFwWBFpG6Wg9hbP3NFcBOljVdfXYyIeIJicI1XVsEvhgc+IiFv88K52YxDXSe3bv++e8R96RHw29M2suBmeysAcuec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057327; c=relaxed/simple; bh=2xktyaXuxUeQFy7UbEKrdepYfkra9ijqMI+msvWBMyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T0XCwAOlPhG2qQbvyIuzNNofVpClTZaeyba4YRmgJfvIdN1Jo9S6flYQqpUQ4Mo2fbFeT5UT8qAieF1TgLVT5q2Os54icOnv3SS9TjPNmbruV4Xf6mZe0WQfeCqJT8Vbs2O/Olv4hcOR9f6szEGpXiySrrl8e2Cruk8Qi+bfC1o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bWQM05Yb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bWQM05Yb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC5EC4CEF5; Sat, 6 Dec 2025 21:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057326; bh=2xktyaXuxUeQFy7UbEKrdepYfkra9ijqMI+msvWBMyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWQM05Yb5w2Nbocl1vxq28Kd0xapOU1/WpIR3MQPdN5daUSnyi6CAWvyxTfQloMQB a1ZGIG58YvpTWMkswhmrjVmjhsxh8bw18PhGy8nANdGcLp5ME/hiDwGBggRit+mwaS Ndxe3Kn4ba7/CshB/5mKXvtcPVHNFwBDxCkZED7hmrmsZ64gjOPyNJuxrqF/rm2rWP lqhphn2Fl1TdjhHfrsGlRTHpYBF0XoZcYrcQfqgATSjuO16ohM8g8vuY1lf4sl2cUC WkhGl8liC20Tv3kgTkvzuD/pwI69WxagGLaoKFY15JxEndG8pSqd6pQcC/IfT4vVKQ Fi5GpZRF95ASQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 5/8] objtool: Convert annotations to assembler macros Date: Sat, 6 Dec 2025 13:41:12 -0800 Message-ID: <28e63e2c890661dc9bcdbe172eba06b26220d455.1765044697.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Improve code generation readability by converting the objtool annotations into assembler macros which are created when annotate.h is included. Before: .pushsection .discard.annotate_insn, "M", @progbits, 8; .long 1b - ., 8; = .popsection After: ANNOTATE_REACHABLE loc=3D1b Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/asm.h | 8 +- arch/x86/include/asm/jump_label.h | 1 + include/linux/annotate.h | 132 +++++++++++++++--------------- 3 files changed, 72 insertions(+), 69 deletions(-) diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 0e8c611bc9e2..770321c908e5 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -2,15 +2,15 @@ #ifndef _ASM_X86_ASM_H #define _ASM_X86_ASM_H =20 -#include - #ifdef __ASSEMBLER__ +# define __ASM_C(a,b) a # define __ASM_FORM(x, ...) x,## __VA_ARGS__ # define __ASM_FORM_RAW(x, ...) x,## __VA_ARGS__ # define __ASM_FORM_COMMA(x, ...) x,## __VA_ARGS__, # define __ASM_REGPFX % #else #include +# define __ASM_C(a,b) b # define __ASM_FORM(x, ...) " " __stringify(x,##__VA_ARGS__) " " # define __ASM_FORM_RAW(x, ...) __stringify(x,##__VA_ARGS__) # define __ASM_FORM_COMMA(x, ...) " " __stringify(x,##__VA_ARGS__) "," @@ -115,6 +115,10 @@ =20 #endif =20 +#define DEFINE_MACRO(name) \ + __ASM_C(DEFINE_ ## name, \ + asm(__stringify(DEFINE_ ## name))) + #ifndef __ASSEMBLER__ static __always_inline __pure void *rip_rel_ptr(void *p) { diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_= label.h index 05b16299588d..d34a16a4d305 100644 --- a/arch/x86/include/asm/jump_label.h +++ b/arch/x86/include/asm/jump_label.h @@ -11,6 +11,7 @@ =20 #include #include +#include =20 #define JUMP_TABLE_ENTRY(key, label) \ ".pushsection __jump_table, \"aw\" \n\t" \ diff --git a/include/linux/annotate.h b/include/linux/annotate.h index 1678410efa1b..8b28f1a81ec4 100644 --- a/include/linux/annotate.h +++ b/include/linux/annotate.h @@ -3,53 +3,43 @@ #define _LINUX_ANNOTATE_H =20 #include +#include +#include + +#define DEFINE___ANNOTATE \ + .macro __ANNOTATE sec, type, loc; \ + .pushsection __ASM_C(\sec, \\sec), "M", @progbits, 8; \ + .long __ASM_C(\loc, \\loc) - .; \ + .long __ASM_C(\type, \\type); \ + .popsection; \ + .endm + +#define __DEFINE_ANNOTATE(sec, name, type) \ + .macro name loc=3D910b; \ + 910: __ANNOTATE sec, type, __ASM_C(\loc, \\loc); \ + .endm + +#define DEFINE_ANNOTATE(type) \ + __DEFINE_ANNOTATE(.discard.annotate_insn, \ + ANNOTATE_ ## type, ANNOTYPE_ ## type) + +#define DEFINE_ANNOTATE_DATA(type) \ + __DEFINE_ANNOTATE(.discard.annotate_data, \ + ANNOTATE_ ## type, ANNOTYPE_ ## type) =20 #ifdef CONFIG_OBJTOOL =20 -#define __ASM_ANNOTATE(section, label, type) \ - .pushsection section, "M", @progbits, 8; \ - .long label - ., type; \ - .popsection - -#ifndef __ASSEMBLY__ - -#define ASM_ANNOTATE_LABEL(label, type) \ - __stringify(__ASM_ANNOTATE(.discard.annotate_insn, label, type)) - -#define ASM_ANNOTATE(type) \ - "911: " \ - __stringify(__ASM_ANNOTATE(.discard.annotate_insn, 911b, type)) - -#define ASM_ANNOTATE_DATA(type) \ - "912: " \ - __stringify(__ASM_ANNOTATE(.discard.annotate_data, 912b, type)) - -#else /* __ASSEMBLY__ */ - -.macro ANNOTATE type -.Lhere_\@: - __ASM_ANNOTATE(.discard.annotate_insn, .Lhere_\@, \type) -.endm - -.macro ANNOTATE_DATA type -.Lhere_\@: - __ASM_ANNOTATE(.discard.annotate_data, .Lhere_\@, \type) -.endm - -#endif /* __ASSEMBLY__ */ - -#else /* !CONFIG_OBJTOOL */ -#ifndef __ASSEMBLY__ -#define ASM_ANNOTATE_LABEL(label, type) "" -#define ASM_ANNOTATE(type) -#define ASM_ANNOTATE_DATA(type) -#else /* __ASSEMBLY__ */ -.macro ANNOTATE type -.endm -.macro ANNOTATE_DATA type -.endm -#endif /* __ASSEMBLY__ */ -#endif /* !CONFIG_OBJTOOL */ +DEFINE_MACRO(__ANNOTATE); +DEFINE_MACRO(ANNOTATE(NOENDBR)); +DEFINE_MACRO(ANNOTATE(RETPOLINE_SAFE)); +DEFINE_MACRO(ANNOTATE(INSTR_BEGIN)); +DEFINE_MACRO(ANNOTATE(INSTR_END)); +DEFINE_MACRO(ANNOTATE(IGNORE_ALTERNATIVE)); +DEFINE_MACRO(ANNOTATE(INTRA_FUNCTION_CALL)); +DEFINE_MACRO(ANNOTATE(UNRET_BEGIN)); +DEFINE_MACRO(ANNOTATE(REACHABLE)); +DEFINE_MACRO(ANNOTATE(NOCFI)); +DEFINE_MACRO(ANNOTATE_DATA(DATA_SPECIAL)); =20 #ifndef __ASSEMBLY__ =20 @@ -57,30 +47,30 @@ * Annotate away the various 'relocation to !ENDBR` complaints; knowing th= at * these relocations will never be used for indirect calls. */ -#define ANNOTATE_NOENDBR ASM_ANNOTATE(ANNOTYPE_NOENDBR) -#define ANNOTATE_NOENDBR_SYM(sym) asm(ASM_ANNOTATE_LABEL(sym, ANNOTYPE_NOE= NDBR)) +#define ANNOTATE_NOENDBR "ANNOTATE_NOENDBR" +#define ANNOTATE_NOENDBR_SYM(sym) asm("ANNOTATE_NOENDBR loc=3D" __stringif= y(sym)) =20 /* * This should be used immediately before an indirect jump/call. It tells * objtool the subsequent indirect jump/call is vouched safe for retpoline * builds. */ -#define ANNOTATE_RETPOLINE_SAFE ASM_ANNOTATE(ANNOTYPE_RETPOLINE_SAFE) +#define ANNOTATE_RETPOLINE_SAFE "ANNOTATE_RETPOLINE_SAFE" /* * See linux/instrumentation.h */ -#define ANNOTATE_INSTR_BEGIN(label) ASM_ANNOTATE_LABEL(label, ANNOTYPE_INS= TR_BEGIN) -#define ANNOTATE_INSTR_END(label) ASM_ANNOTATE_LABEL(label, ANNOTYPE_INSTR= _END) +#define ANNOTATE_INSTR_BEGIN(label) "ANNOTATE_INSTR_BEGIN loc=3D" __string= ify(label) +#define ANNOTATE_INSTR_END(label) "ANNOTATE_INSTR_END loc=3D" __stringify(= label) /* * objtool annotation to ignore the alternatives and only consider the ori= ginal * instruction(s). */ -#define ANNOTATE_IGNORE_ALTERNATIVE ASM_ANNOTATE(ANNOTYPE_IGNORE_ALTERNATI= VE) +#define ANNOTATE_IGNORE_ALTERNATIVE "ANNOTATE_IGNORE_ALTERNATIVE" /* * This macro indicates that the following intra-function call is valid. * Any non-annotated intra-function call will cause objtool to issue a war= ning. */ -#define ANNOTATE_INTRA_FUNCTION_CALL ASM_ANNOTATE(ANNOTYPE_INTRA_FUNCTION_= CALL) +#define ANNOTATE_INTRA_FUNCTION_CALL "ANNOTATE_INTRA_FUNCTION_CALL" /* * Use objtool to validate the entry requirement that all code paths do * VALIDATE_UNRET_END before RET. @@ -88,13 +78,13 @@ * NOTE: The macro must be used at the beginning of a global symbol, other= wise * it will be ignored. */ -#define ANNOTATE_UNRET_BEGIN ASM_ANNOTATE(ANNOTYPE_UNRET_BEGIN) +#define ANNOTATE_UNRET_BEGIN "ANNOTATE_UNRET_BEGIN" /* * This should be used to refer to an instruction that is considered * terminating, like a noreturn CALL or UD2 when we know they are not -- eg * WARN using UD2. */ -#define ANNOTATE_REACHABLE_LABEL(label) ASM_ANNOTATE_LABEL(label, ANNOTYPE= _REACHABLE) +#define ANNOTATE_REACHABLE_LABEL(label) "ANNOTATE_REACHABLE loc=3D" __stri= ngify(label) /* * This should not be used; it annotates away CFI violations. There are a = few * valid use cases like kexec handover to the next kernel image, and there= is @@ -103,25 +93,33 @@ * There are also a few real issues annotated away, like EFI because we ca= n't * control the EFI code. */ -#define ANNOTATE_NOCFI_SYM(sym) asm(ASM_ANNOTATE_LABEL(sym, ANNOTYPE_NOCF= I)) +#define ANNOTATE_NOCFI_SYM(sym) asm("ANNOTATE_NOCFI loc=3D" __stringify(s= ym)) =20 /* * Annotate a special section entry. This emables livepatch module genera= tion * to find and extract individual special section entries as needed. */ -#define ANNOTATE_DATA_SPECIAL ASM_ANNOTATE_DATA(ANNOTYPE_DATA_SPECIAL) +#define ANNOTATE_DATA_SPECIAL "ANNOTATE_DATA_SPECIAL" =20 -#else /* __ASSEMBLY__ */ -#define ANNOTATE_NOENDBR ANNOTATE type=3DANNOTYPE_NOENDBR -#define ANNOTATE_RETPOLINE_SAFE ANNOTATE type=3DANNOTYPE_RETPOLINE_SAFE -/* ANNOTATE_INSTR_BEGIN ANNOTATE type=3DANNOTYPE_INSTR_BEGIN */ -/* ANNOTATE_INSTR_END ANNOTATE type=3DANNOTYPE_INSTR_END */ -#define ANNOTATE_IGNORE_ALTERNATIVE ANNOTATE type=3DANNOTYPE_IGNORE_ALTERN= ATIVE -#define ANNOTATE_INTRA_FUNCTION_CALL ANNOTATE type=3DANNOTYPE_INTRA_FUNCTI= ON_CALL -#define ANNOTATE_UNRET_BEGIN ANNOTATE type=3DANNOTYPE_UNRET_BEGIN -#define ANNOTATE_REACHABLE ANNOTATE type=3DANNOTYPE_REACHABLE -#define ANNOTATE_NOCFI ANNOTATE type=3DANNOTYPE_NOCFI -#define ANNOTATE_DATA_SPECIAL ANNOTATE_DATA type=3DANNOTYPE_DATA_SPECIAL -#endif /* __ASSEMBLY__ */ +#endif /* !__ASSEMBLY__ */ + +#else /* !OBJTOOL */ + +#define ANNOTATE_NOENDBR +#define ANNOTATE_NOENDBR_SYM(sym) +#define ANNOTATE_RETPOLINE_SAFE +#define ANNOTATE_INSTR_BEGIN(label) +#define ANNOTATE_INSTR_END(label) +#define ANNOTATE_IGNORE_ALTERNATIVE +#define ANNOTATE_INTRA_FUNCTION_CALL +#define ANNOTATE_UNRET_BEGIN +#define ANNOTATE_REACHABLE +#define ANNOTATE_REACHABLE_LABEL(label) +#define ANNOTATE_NOCFI +#define ANNOTATE_NOCFI_SYM(sym) +#define ANNOTATE_DATA_SPECIAL +#define __ANNOTATE_DATA_SPECIAL(l) + +#endif /* !OBJTOOL */ =20 #endif /* _LINUX_ANNOTATE_H */ --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 592DA2E1C6B for ; Sat, 6 Dec 2025 21:42:07 +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=1765057327; cv=none; b=osLhYf3vDDgZKbPx1lil8QLlxjoXl3t9O2Nsc4a/XkZaJp+VQ5LHfUWRAJecniXFdCYUEiH6ghLEH4Hc/yiPP9YcYMqHZFWhRoVTsZwpcCGYH2R5OvsznugHCrBsPwIvJtCqVyiI3RUXZQvU6xKKywJvoY6vrN/Swz62PP+3lQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057327; c=relaxed/simple; bh=eHziHNSIZwiBrOR54sdUBESMVhX+uNYi7eeeOFGuka0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NhzO4qDfCEgs10g6peicwjof4vt5uCRLlawSGSAmFeqR9uyvLBIOb6Bl65yO/r1lQuUXwW4XmelfUem2cTuvmpSG/PG3zMVjDDPqWsKYXYlnpQPyNGXcbpnn09JzQNqwGgupUXNYk46fBKbTheVzPT9TIpFVknj/OXwAXxf/eX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lK18WlA9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lK18WlA9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A48D1C116D0; Sat, 6 Dec 2025 21:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057326; bh=eHziHNSIZwiBrOR54sdUBESMVhX+uNYi7eeeOFGuka0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lK18WlA9AkgRS//sUpI4YY/ggSAFmz1WsiwB+Oj7iK+YFqhXUIjKDF0pfxXfBvyaz 7tccrbMxyfVj8m88BuzEMSbRIYbnHhktlpg/5XfQMoG4kzBxVbiZBYNj4uNY0vPqn9 q5+cEJcI7Q1nG2XP6rnAQQ/KXKEFBCCIdx9ePyEIetXsP9obaFsdEAZn9NEWvdMmfd b6T32LZiPMqKb9ZK2L8aibDvlH3Zw7RZ8nmJs4VVGGxjDeyW2/SEphv/EZ2ck/NWls Z4GKt3AHNfVADbbwwAyTWeygb8zSIiSgmLhfTDZicGTEkpQgmW3oXmeZAnfO1y89H1 AEPqPAWBv3Ohw== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 6/8] x86/asm: Use unique code labels in __FILL_RETURN_BUFFER Date: Sat, 6 Dec 2025 13:41:13 -0800 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In preparation for unifying the C and asm alternative implementations, change the code labels in __FILL_RETURN_BUFFER to be unique. The 771 and 772 labels are used by the C alternative implementation, which will soon be extended for asm. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/nospec-branch.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/no= spec-branch.h index a5d41d8cd70a..334c6058a1ec 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -126,9 +126,9 @@ */ #define __FILL_RETURN_SLOT \ ANNOTATE_INTRA_FUNCTION_CALL; \ - call 772f; \ + call 872f; \ int3; \ -772: +872: =20 /* * Stuff the entire RSB. @@ -140,12 +140,12 @@ #ifdef CONFIG_X86_64 #define __FILL_RETURN_BUFFER(reg, nr) \ mov $(nr/2), reg; \ -771: \ +871: \ __FILL_RETURN_SLOT \ __FILL_RETURN_SLOT \ add $(BITS_PER_LONG/8) * 2, %_ASM_SP; \ dec reg; \ - jnz 771b; \ + jnz 871b; \ /* barrier for jnz misprediction */ \ lfence; \ CREDIT_CALL_DEPTH \ --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 D18EE2E6CA8 for ; Sat, 6 Dec 2025 21:42:07 +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=1765057328; cv=none; b=VD4ri1MkCYzoO88CK0YqOW8TXJINtMRF5BUpfAdID8GZoeuBaeFz3DXEo5NbMBGksbJw7jyI62u3hr4gvhlwb6EHbjMSqF52zYXvh5Go/IRZfJj2kMsliz2zWrAEE1kfpkmIUP3ew5qJ0GBYDy/YarQkgSwHCGBxlC77A0UO3qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057328; c=relaxed/simple; bh=bynW1PXxVR1ef5FuIbdHtk/LjqESIuYfTS+rgwC+YEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l5bD4R9w5PHGGhP5uOWxuo6yOSGagQdKw8RirvAbtl7iyBcJiIxbWcug6hyUVSMAZAjghlNdoJa4kwBVz1tGlpvH6uWC8IhzrUYy+RRUIsKqu1Ne2NOgrh2ptga1jxirzSx5vXvaX5IhTNx977A4/gMo+dcrDtqAEG/gaBPHieA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bTLGk0UR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bTLGk0UR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14972C16AAE; Sat, 6 Dec 2025 21:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057327; bh=bynW1PXxVR1ef5FuIbdHtk/LjqESIuYfTS+rgwC+YEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bTLGk0UR09l0CSjvLvCzQSGKnIPFRz/YS7BkRseBKkhMy0p+Nm1m7CdV573dGDNak aqXaMiLGSeS5or4xOg/Uvw+GYDscHFT23ksIxcS9G+prO8EpHMPo2rpXxzd95xTZjs 4c2T3yu7sqpaNtoQChTVCXl7hJi0KDID2a3n/YNeS3OXDy9QmrLgn5g/sqakBHOFnA CRo+gFRsq3KAPc52aIUrXCtggYgH0jEkzg2VWZ4G2xb1HjkcZayAfDcVhNVGzTvi8x ABnDUskUzrDzOM6EdxBLv8pU/LfdEUDpnJjn8oeXwk96anfq++2KzmasTaPNivnonH AOG1vir6qENwg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 7/8] x86/asm: Remove newlines in alternatives Date: Sat, 6 Dec 2025 13:41:14 -0800 Message-ID: <1f7483f82da0f857ff01c6a8e906df088fb0aa05.1765044697.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In preparation for converting the alternative implementation to assembler macros, remove all newlines from alternative instructions. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/paravirt_types.h | 2 +- arch/x86/include/asm/processor.h | 2 +- arch/x86/include/asm/smap.h | 8 ++++---- arch/x86/include/asm/vmware.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/p= aravirt_types.h index 3502939415ad..a05fcc4f5172 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -249,7 +249,7 @@ extern struct paravirt_patch_template pv_ops; * don't need to bother with CFI prefixes. */ #define PARAVIRT_CALL \ - ANNOTATE_RETPOLINE_SAFE "\n\t" \ + ANNOTATE_RETPOLINE_SAFE "; " \ "call *%[paravirt_opptr];" =20 /* diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/proces= sor.h index a24c7805acdb..816dbddd7507 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -706,7 +706,7 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu) */ static __always_inline void amd_clear_divider(void) { - asm volatile(ALTERNATIVE("", "div %2\n\t", X86_BUG_DIV0) + asm volatile(ALTERNATIVE("", "div %2", X86_BUG_DIV0) :: "a" (0), "d" (0), "r" (1)); } =20 diff --git a/arch/x86/include/asm/smap.h b/arch/x86/include/asm/smap.h index 977bef14a0ab..d9d565024e3b 100644 --- a/arch/x86/include/asm/smap.h +++ b/arch/x86/include/asm/smap.h @@ -77,7 +77,7 @@ static __always_inline unsigned long smap_save(void) unsigned long flags; =20 asm volatile ("# smap_save\n\t" - ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE "\n\t" + ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE "", "pushf; pop %0; clac", X86_FEATURE_SMAP) : "=3Drm" (flags) : : "memory", "cc"); @@ -88,7 +88,7 @@ static __always_inline unsigned long smap_save(void) static __always_inline void smap_restore(unsigned long flags) { asm volatile ("# smap_restore\n\t" - ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE "\n\t" + ALTERNATIVE(ANNOTATE_IGNORE_ALTERNATIVE "", "push %0; popf", X86_FEATURE_SMAP) : : "g" (flags) : "memory", "cc"); @@ -101,9 +101,9 @@ static __always_inline void smap_restore(unsigned long = flags) ALTERNATIVE("", "stac", X86_FEATURE_SMAP) =20 #define ASM_CLAC_UNSAFE \ - ALTERNATIVE("", ANNOTATE_IGNORE_ALTERNATIVE "\n\t" "clac", X86_FEATURE_SM= AP) + ALTERNATIVE("", ANNOTATE_IGNORE_ALTERNATIVE "; clac", X86_FEATURE_SMAP) #define ASM_STAC_UNSAFE \ - ALTERNATIVE("", ANNOTATE_IGNORE_ALTERNATIVE "\n\t" "stac", X86_FEATURE_SM= AP) + ALTERNATIVE("", ANNOTATE_IGNORE_ALTERNATIVE "; stac", X86_FEATURE_SMAP) =20 #endif /* __ASSEMBLER__ */ =20 diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h index c9cf43d5ef23..100fba7555bf 100644 --- a/arch/x86/include/asm/vmware.h +++ b/arch/x86/include/asm/vmware.h @@ -90,7 +90,7 @@ extern unsigned long vmware_tdx_hypercall(unsigned long c= md, * set. The high word of %edx may contain input data from the caller. */ #define VMWARE_HYPERCALL \ - ALTERNATIVE_2("movw %[port], %%dx\n\t" \ + ALTERNATIVE_2("movw %[port], %%dx; " \ "inl (%%dx), %%eax", \ "vmcall", X86_FEATURE_VMCALL, \ "vmmcall", X86_FEATURE_VMW_VMMCALL) --=20 2.52.0 From nobody Fri Dec 19 12:44:57 2025 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 E23062E5B09 for ; Sat, 6 Dec 2025 21:42:07 +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=1765057328; cv=none; b=SgjHWnA+m1URnEL7Jx7m63D4on5QpwucBFhNCAV21G3DBioK+Fq8qNIWjubb/+kIPAjS9aac/oEJx/pwpz1Qwp7X6m/zUVZAJM+/gFZCah5wJyEyTU5ODXSv9fOK4ZtO1u7qfji8/wOVpdsSyJYQMhYtoP3niRMz12QIU4vgtck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765057328; c=relaxed/simple; bh=reEyLSsptVB2gduPmHwa/pY5nyaIwkkto5v6ZjzdoAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cUvnFJXg95zTx+Jd9l2zt4IJofvY48J29v/3h71frDh5Co6SEyIf99XA4Bc6IeQBegJPgmYekk6xwE951BZIwB14votoaHNUfZH1Oh4fIx7dewCIm9hzaei+IQpDHKq1uik7pgEBJoWC4eYvj9fgwL9Cz1LH2/E1BazOV3XmkxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eJMX7o4b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eJMX7o4b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80A72C4CEF5; Sat, 6 Dec 2025 21:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765057327; bh=reEyLSsptVB2gduPmHwa/pY5nyaIwkkto5v6ZjzdoAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJMX7o4b7fpxuV/LiX3XM1SasykbjwN/+Cg4QIp5lGgpGtoy72tmnNElwnM3gZBRL WEIdPmIdpkZutekMihods6h0tjTwq4ilKjqmmANcSQK3Imocemm/iny+qGBS9oLI/D c/6WCyhBR6ye7twtYTwRwo0KhcBOqNST8Zx/+sPPGbis9ZZJbHR6YvZ/at0o/ItCTT sjth5AJSy9npnVI+9FUwbLFGH7Yq1Lk8GZEk0qV0gVZxwzFDbGH5eeaJ67GqnwWjdk pENcEiANBlAAnDKnK0pArvn1e3KHJw0JtuDXbxqQtXKGENISfwGnXcoPqoPONAP9Qi BQ5sv4UISL2eg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra , Borislav Petkov , Thomas Gleixner Subject: [PATCH 8/8] x86/alternative: Convert alternatives to assembler macros Date: Sat, 6 Dec 2025 13:41:15 -0800 Message-ID: <051df5c21cbf6d9ac396c22b3ab3c51d73c0def7.1765044697.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Improve code generation readability by converting the alternatives into assembler macros which are created when alternative.h is included. Before: # ./arch/x86/include/asm/smap.h:47: alternative("", "stac", X86_FEATURE_= SMAP); # 47 "./arch/x86/include/asm/smap.h" 1 # ALT: oldinstr 771: 772: # ALT: padding .skip -(((775f-774f)-(772b-771b)) > 0) * ((775f-774f)-(772b-771b)),0x90 773: .pushsection .altinstructions, "aM", @progbits, 14 .long 771b - . .long 774f - . .4byte ( 9*32+20) .byte 773b-771b .byte 775f-774f .popsection .pushsection .altinstr_replacement, "ax" ANNOTATE_DATA_SPECIAL # ALT: replacement 774: stac 775: .popsection After: # ./arch/x86/include/asm/smap.h:47: alternative("", "stac", X86_FEATURE_= SMAP); # 47 "./arch/x86/include/asm/smap.h" 1 ALTERNATIVE "", "stac", "( 9*32+20)" Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/alternative.h | 196 +++++++++++++++-------------- include/linux/annotate.h | 7 +- 2 files changed, 107 insertions(+), 96 deletions(-) diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alte= rnative.h index 03364510d5fe..89c69fe8f337 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -8,6 +8,90 @@ #include #include =20 +/* + * CALC_MAX: assembler-compatible max based on the idea from: + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax + * + * The additional "-" is needed because gas uses a "true" value of -1. + */ +#define CALC_MAX(a, b) (a ^ ((a ^ b) & -(-(a < b)))) + +/* Add padding after the original instructions so the replacements can fit= . */ +#define __ALT_SKIP(orig_len, len1, len2, len3) \ + .skip -((CALC_MAX(CALC_MAX(len1, len2), len3) - orig_len) > 0) *\ + (CALC_MAX(CALC_MAX(len1, len2), len3) - orig_len), 0x90 + +#define ALT_SKIP __ALT_SKIP((772b-771b), (775f-774f), (776f-775f), (777f-7= 76f)) + +#define ALT_REPLACE(newinstr1, newinstr2, newinstr3) \ + .pushsection .altinstr_replacement, "ax"; \ + 774: newinstr1; \ + 775: newinstr2; \ + 776: newinstr3; \ + 777: \ + .popsection + +#define ALT_ENTRY(orig_begin, orig_end, new_begin, new_end, ft_flags) \ + __ANNOTATE_DATA_SPECIAL(new_begin); \ + .pushsection .altinstructions, "aM", @progbits, ALT_INSTR_SIZE; \ + .long orig_begin - .; \ + .long new_begin - .; \ + .4byte ft_flags; \ + .byte orig_end - orig_begin; \ + .byte new_end - new_begin; \ + .popsection + +/* + * These ALTERNATIVE .macros get created when this file gets included: + */ + +#define DEFINE_ALTERNATIVE \ +.macro ALTERNATIVE oldinstr, newinstr, ft_flags; \ + 771: __ASM_C(\oldinstr, \\oldinstr); \ + 772: ALT_SKIP; \ + 773: \ + ALT_REPLACE(__ASM_C(\newinstr, \\newinstr),,); \ + ALT_ENTRY(771b, 773b, 774b, 775b, \ + __ASM_C(\ft_flags, \\ft_flags)); \ +.endm + +#define DEFINE_ALTERNATIVE_2 \ +.macro ALTERNATIVE_2 oldinstr, newinstr1, ft_flags1, \ + newinstr2, ft_flags2; \ + 771: __ASM_C(\oldinstr, \\oldinstr); \ + 772: ALT_SKIP; \ + 773: \ + ALT_REPLACE(__ASM_C(\newinstr1, \\newinstr1), \ + __ASM_C(\newinstr2, \\newinstr2),); \ + ALT_ENTRY(771b, 773b, 774b, 775b, \ + __ASM_C(\ft_flags1, \\ft_flags1)); \ + ALT_ENTRY(771b, 773b, 775b, 776b, \ + __ASM_C(\ft_flags2, \\ft_flags2)); \ +.endm + +#define DEFINE_ALTERNATIVE_3 \ +.macro ALTERNATIVE_3 oldinstr, newinstr1, ft_flags1, \ + newinstr2, ft_flags2, \ + newinstr3, ft_flags3; \ + 771: __ASM_C(\oldinstr, \\oldinstr); \ + 772: ALT_SKIP; \ + 773: \ + ALT_REPLACE(__ASM_C(\newinstr1, \\newinstr1), \ + __ASM_C(\newinstr2, \\newinstr2), \ + __ASM_C(\newinstr3, \\newinstr3)); \ + ALT_ENTRY(771b, 773b, 774b, 775b, \ + __ASM_C(\ft_flags1, \\ft_flags1)); \ + ALT_ENTRY(771b, 773b, 775b, 776b, \ + __ASM_C(\ft_flags2, \\ft_flags2)); \ + ALT_ENTRY(771b, 773b, 776b, 777b, \ + __ASM_C(\ft_flags3, \\ft_flags3)); \ +.endm + +DEFINE_MACRO(ALTERNATIVE); +DEFINE_MACRO(ALTERNATIVE_2); +DEFINE_MACRO(ALTERNATIVE_3); + + #define ALT_FLAGS_SHIFT 16 =20 #define ALT_FLAG_NOT (1 << 0) @@ -184,53 +268,30 @@ static inline int alternatives_text_reserved(void *st= art, void *end) =20 #define ALT_CALL_INSTR "call BUG_func" =20 -#define alt_slen "772b-771b" -#define alt_total_slen "773b-771b" -#define alt_rlen "775f-774f" +#define ALTERNATIVE(oldinstr, newinstr, ft_flags) \ + "ALTERNATIVE \"" oldinstr "\", " \ + "\"" newinstr "\", \"" __stringify(ft_flags) "\"\n" =20 -#define OLDINSTR(oldinstr) \ - "# ALT: oldinstr\n" \ - "771:\n\t" oldinstr "\n772:\n" \ - "# ALT: padding\n" \ - ".skip -(((" alt_rlen ")-(" alt_slen ")) > 0) * " \ - "((" alt_rlen ")-(" alt_slen ")),0x90\n" \ - "773:\n" +#define ALTERNATIVE_2(oldinstr, \ + newinstr1, ft_flags1, \ + newinstr2, ft_flags2) \ + "ALTERNATIVE_2 \"" oldinstr "\", " \ + "\"" newinstr1 "\", \"" __stringify(ft_flags1) "\", " \ + "\"" newinstr2 "\", \"" __stringify(ft_flags2) "\"\n" =20 -#define ALTINSTR_ENTRY(ft_flags) \ - ".pushsection .altinstructions, \"aM\", @progbits, " \ - __stringify(ALT_INSTR_SIZE) "\n" \ - " .long 771b - .\n" /* label */ \ - " .long 774f - .\n" /* new instruction */ \ - " .4byte " __stringify(ft_flags) "\n" /* feature + flags */ \ - " .byte " alt_total_slen "\n" /* source len */ \ - " .byte " alt_rlen "\n" /* replacement len */ \ - ".popsection\n" - -#define ALTINSTR_REPLACEMENT(newinstr) /* replacement */ \ - ".pushsection .altinstr_replacement, \"ax\"\n" \ - ANNOTATE_DATA_SPECIAL "\n" \ - "# ALT: replacement\n" \ - "774:\n\t" newinstr "\n775:\n" \ - ".popsection\n" - -/* alternative assembly primitive: */ -#define ALTERNATIVE(oldinstr, newinstr, ft_flags) \ - OLDINSTR(oldinstr) \ - ALTINSTR_ENTRY(ft_flags) \ - ALTINSTR_REPLACEMENT(newinstr) - -#define ALTERNATIVE_2(oldinstr, newinstr1, ft_flags1, newinstr2, ft_flags2= ) \ - ALTERNATIVE(ALTERNATIVE(oldinstr, newinstr1, ft_flags1), newinstr2, ft_fl= ags2) +#define ALTERNATIVE_3(oldinstr, \ + newinstr1, ft_flags1, \ + newinstr2, ft_flags2, \ + newinstr3, ft_flags3) \ + "ALTERNATIVE_3 \"" oldinstr "\", " \ + "\"" newinstr1 "\", \"" __stringify(ft_flags1) "\", " \ + "\"" newinstr2 "\", \"" __stringify(ft_flags2) "\", " \ + "\"" newinstr3 "\", \"" __stringify(ft_flags3) "\"\n" =20 /* If @feature is set, patch in @newinstr_yes, otherwise @newinstr_no. */ #define ALTERNATIVE_TERNARY(oldinstr, ft_flags, newinstr_yes, newinstr_no)= \ ALTERNATIVE_2(oldinstr, newinstr_no, X86_FEATURE_ALWAYS, newinstr_yes, ft= _flags) =20 -#define ALTERNATIVE_3(oldinstr, newinstr1, ft_flags1, newinstr2, ft_flags2= , \ - newinstr3, ft_flags3) \ - ALTERNATIVE(ALTERNATIVE_2(oldinstr, newinstr1, ft_flags1, newinstr2, ft_f= lags2), \ - newinstr3, ft_flags3) - /* * Alternative instructions for different CPU types or capabilities. * @@ -332,65 +393,10 @@ void nop_func(void); .endm #endif =20 -/* - * Issue one struct alt_instr descriptor entry (need to put it into - * the section .altinstructions, see below). This entry contains - * enough information for the alternatives patching code to patch an - * instruction. See apply_alternatives(). - */ -.macro altinstr_entry orig alt ft_flags orig_len alt_len - .long \orig - . - .long \alt - . - .4byte \ft_flags - .byte \orig_len - .byte \alt_len -.endm - .macro ALT_CALL_INSTR call BUG_func .endm =20 -/* - * Define an alternative between two instructions. If @feature is - * present, early code in apply_alternatives() replaces @oldinstr with - * @newinstr. ".skip" directive takes care of proper instruction padding - * in case @newinstr is longer than @oldinstr. - */ -#define __ALTERNATIVE(oldinst, newinst, flag) \ -740: \ - oldinst ; \ -741: \ - .skip -(((744f-743f)-(741b-740b)) > 0) * ((744f-743f)-(741b-740b)),0x90 ;\ -742: \ - .pushsection .altinstructions, "aM", @progbits, ALT_INSTR_SIZE ;\ - altinstr_entry 740b,743f,flag,742b-740b,744f-743f ; \ - .popsection ; \ - .pushsection .altinstr_replacement,"ax" ; \ -743: \ - ANNOTATE_DATA_SPECIAL ; \ - newinst ; \ -744: \ - .popsection ; - -.macro ALTERNATIVE oldinstr, newinstr, ft_flags - __ALTERNATIVE(\oldinstr, \newinstr, \ft_flags) -.endm - -/* - * Same as ALTERNATIVE macro above but for two alternatives. If CPU - * has @feature1, it replaces @oldinstr with @newinstr1. If CPU has - * @feature2, it replaces @oldinstr with @feature2. - */ -.macro ALTERNATIVE_2 oldinstr, newinstr1, ft_flags1, newinstr2, ft_flags2 - __ALTERNATIVE(__ALTERNATIVE(\oldinstr, \newinstr1, \ft_flags1), - \newinstr2, \ft_flags2) -.endm - -.macro ALTERNATIVE_3 oldinstr, newinstr1, ft_flags1, newinstr2, ft_flags2,= newinstr3, ft_flags3 - __ALTERNATIVE(ALTERNATIVE_2(\oldinstr, \newinstr1, \ft_flags1, \newinstr2= , \ft_flags2), - \newinstr3, \ft_flags3) -.endm - /* If @feature is set, patch in @newinstr_yes, otherwise @newinstr_no. */ #define ALTERNATIVE_TERNARY(oldinstr, ft_flags, newinstr_yes, newinstr_no)= \ ALTERNATIVE_2 oldinstr, newinstr_no, X86_FEATURE_ALWAYS, \ diff --git a/include/linux/annotate.h b/include/linux/annotate.h index 8b28f1a81ec4..a80fef36dc92 100644 --- a/include/linux/annotate.h +++ b/include/linux/annotate.h @@ -100,8 +100,13 @@ DEFINE_MACRO(ANNOTATE_DATA(DATA_SPECIAL)); * to find and extract individual special section entries as needed. */ #define ANNOTATE_DATA_SPECIAL "ANNOTATE_DATA_SPECIAL" +#define __ANNOTATE_DATA_SPECIAL(label) __ANNOTATE .discard.annotate_data, = ANNOTYPE_DATA_SPECIAL, label =20 -#endif /* !__ASSEMBLY__ */ +#else /* __ASSEMBLY__ */ + +#define __ANNOTATE_DATA_SPECIAL(label) ANNOTATE_DATA_SPECIAL loc=3Dlabel + +#endif /* __ASSEMBLY__ */ =20 #else /* !OBJTOOL */ =20 --=20 2.52.0