lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176397550597.498.7510607683028171294.tip-bot2@tip-bot2>
Date: Mon, 24 Nov 2025 09:11:45 -0000
From: "tip-bot2 for Alexandre Chartre" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Alexandre Chartre <alexandre.chartre@...cle.com>,
 "Peter Zijlstra (Intel)" <peterz@...radead.org>,
 Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: objtool/core] objtool: Preserve alternatives order

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     7ad7a4a72050a74f8927719272075d07d2f7777f
Gitweb:        https://git.kernel.org/tip/7ad7a4a72050a74f8927719272075d07d2f7777f
Author:        Alexandre Chartre <alexandre.chartre@...cle.com>
AuthorDate:    Fri, 21 Nov 2025 10:53:28 +01:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Fri, 21 Nov 2025 15:30:12 +01:00

objtool: Preserve alternatives order

Preserve the order in which alternatives are defined. Currently
objtool stores alternatives in a list in reverse order.

Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Josh Poimboeuf <jpoimboe@...nel.org>
Link: https://patch.msgid.link/20251121095340.464045-19-alexandre.chartre@oracle.com
---
 tools/objtool/check.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 9cd9f9d..f75364f 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1921,6 +1921,7 @@ static int add_special_section_alts(struct objtool_file *file)
 	struct special_alt *special_alt, *tmp;
 	enum alternative_type alt_type;
 	struct alternative *alt;
+	struct alternative *a;
 
 	if (special_get_alts(file->elf, &special_alts))
 		return -1;
@@ -1973,9 +1974,20 @@ static int add_special_section_alts(struct objtool_file *file)
 		}
 
 		alt->insn = new_insn;
-		alt->next = orig_insn->alts;
 		alt->type = alt_type;
-		orig_insn->alts = alt;
+		alt->next = NULL;
+
+		/*
+		 * Store alternatives in the same order they have been
+		 * defined.
+		 */
+		if (!orig_insn->alts) {
+			orig_insn->alts = alt;
+		} else {
+			for (a = orig_insn->alts; a->next; a = a->next)
+				;
+			a->next = alt;
+		}
 
 		list_del(&special_alt->list);
 		free(special_alt);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ