From nobody Tue Dec 16 21:11:19 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 CBF242C21CF for ; Tue, 2 Dec 2025 18:00:21 +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=1764698421; cv=none; b=px462bLzPl7fAIoHnSGTcIC1tBqlHCjalUdzcrHKRqoiGY1Mx3JIi6Wh+5qY7zCpqJm9QjIKTaRzvBlEjdPoW/aRkxt5UXCJNRhtAzwP0cmKVU13VcEHEsiWywbqfN7wYfHHjpZu+lvqFCqw3HkfC7mknfzhUUnZONBw/9HioUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764698421; c=relaxed/simple; bh=3UnICJ31FhOGm/aH/7DlXBl6FN6bTVPh+SsH1jYO8ss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y+8PFQ90udhwk3+fWfknR242QE3Qf5dxhZSAnPXf0BYiKNLIBFLWo1ZRrsEgD8bKm3vfBtwFjUd/8Fo/ef1TAS/35dpBWtSy4vS02tRFi0WJVBPghUzYnQmhEQFOYdRstVh4zx8m8D9/dyOHhlrvd5kuKSoPlM+lrU3mg7INt9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jqaUaAaT; 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="jqaUaAaT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEAABC116D0; Tue, 2 Dec 2025 18:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764698421; bh=3UnICJ31FhOGm/aH/7DlXBl6FN6bTVPh+SsH1jYO8ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqaUaAaTynFKxNJm95B8CTCinlPYBuCBLDJWMtAB5q1Thz7nAzkMK5lxZ70SUfYgp DFph1Aaq6q/kQLM8hUll4nRTM+p3+2p0OmIq9S+fwBqsj3y8mI+7RWqH9Cf94j8bGA j3EyZGo+V+c4vM1eC1MBou/gBMCd+Da5yGN8Yol0PHujJ3ACfEKPRTOt+cLPIYELv3 q2Z0GgGPc1AcJxitko2eUt7vOYFqUEaMzI3YDECDa7OMqrXEFaoo+63kD32j7K64PP 5zsA26ML2Sns+uMp8Dz+LjEAVHxioBP8RX3mQP8YGtihw8R/jbesJqwl78pgZ62y0Q Q6M3F38XcPC0A== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar Subject: [PATCH v2 1/4] x86/alternative: Remove ANNOTATE_DATA_SPECIAL usage Date: Tue, 2 Dec 2025 09:59:36 -0800 Message-ID: <5ac04e6db5be6453dce8003a771ebb0c47b4cd7a.1764694625.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.51.1 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" Instead of manually annotating each .altinstructions entry, just make the section mergeable and store the entry size in the ELF section header. Either way works for objtool create_fake_symbols(), this way produces cleaner code generation. Signed-off-by: Josh Poimboeuf --- arch/um/include/shared/common-offsets.h | 2 ++ arch/x86/include/asm/alternative.h | 7 +++---- arch/x86/kernel/asm-offsets.c | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/um/include/shared/common-offsets.h b/arch/um/include/shar= ed/common-offsets.h index 8ca66a1918c3..4e19103afd71 100644 --- a/arch/um/include/shared/common-offsets.h +++ b/arch/um/include/shared/common-offsets.h @@ -18,3 +18,5 @@ DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC); DEFINE(UM_KERN_GDT_ENTRY_TLS_ENTRIES, GDT_ENTRY_TLS_ENTRIES); =20 DEFINE(UM_SECCOMP_ARCH_NATIVE, SECCOMP_ARCH_NATIVE); + +DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr)); diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alte= rnative.h index b14c045679e1..df2c8705e17b 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -197,8 +197,8 @@ static inline int alternatives_text_reserved(void *star= t, void *end) "773:\n" =20 #define ALTINSTR_ENTRY(ft_flags) \ - ".pushsection .altinstructions,\"a\"\n" \ - ANNOTATE_DATA_SPECIAL \ + ".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 */ \ @@ -339,7 +339,6 @@ void nop_func(void); * instruction. See apply_alternatives(). */ .macro altinstr_entry orig alt ft_flags orig_len alt_len - ANNOTATE_DATA_SPECIAL .long \orig - . .long \alt - . .4byte \ft_flags @@ -363,7 +362,7 @@ void nop_func(void); 741: \ .skip -(((744f-743f)-(741b-740b)) > 0) * ((744f-743f)-(741b-740b)),0x90 ;\ 742: \ - .pushsection .altinstructions,"a" ; \ + .pushsection .altinstructions, "aM", @progbits, ALT_INSTR_SIZE ;\ altinstr_entry 740b,743f,flag,742b-740b,744f-743f ; \ .popsection ; \ .pushsection .altinstr_replacement,"ax" ; \ diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c index 32ba599a51f8..db3bb5143329 100644 --- a/arch/x86/kernel/asm-offsets.c +++ b/arch/x86/kernel/asm-offsets.c @@ -124,4 +124,6 @@ static void __used common(void) OFFSET(ARIA_CTX_rounds, aria_ctx, rounds); #endif =20 + BLANK(); + DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr)); } --=20 2.51.1