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: <20251112160315.2207947-21-alexandre.chartre@oracle.com>
Date: Wed, 12 Nov 2025 17:03:07 +0100
From: Alexandre Chartre <alexandre.chartre@...cle.com>
To: linux-kernel@...r.kernel.org, mingo@...nel.org, jpoimboe@...nel.org,
        peterz@...radead.org
Cc: alexandre.chartre@...cle.com
Subject: [PATCH v3 20/28] objtool: Disassemble exception table alternatives

When using the --disas option, also disable exception tables (EX_TABLE)

Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
---
 tools/objtool/disas.c | 45 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/tools/objtool/disas.c b/tools/objtool/disas.c
index dabf2340e9ccf..42f3bf310b033 100644
--- a/tools/objtool/disas.c
+++ b/tools/objtool/disas.c
@@ -535,13 +535,26 @@ static int disas_alt_init(struct disas_alt *dalt,
 			  struct alternative *alt,
 			  int alt_num)
 {
+	char *str;
+
 	dalt->orig_insn = orig_insn;
 	dalt->alt = alt;
 	dalt->insn_idx = 0;
-	dalt->name = alt ? strfmt("ALTERNATIVE %d", alt_num) :
-		strfmt("<alternative.%lx>", orig_insn->offset);
-	if (!dalt->name)
+	if (!alt) {
+		str = strfmt("<alternative.%lx>", orig_insn->offset);
+	} else {
+		switch (alt->type) {
+		case ALT_TYPE_EX_TABLE:
+			str = strdup("EXCEPTION");
+			break;
+		default:
+			str = strfmt("ALTERNATIVE %d", alt_num);
+			break;
+		}
+	}
+	if (!str)
 		return -1;
+	dalt->name = str;
 	dalt->width = strlen(dalt->name);
 
 	return 0;
@@ -567,6 +580,26 @@ static int disas_alt_add_insn(struct disas_alt *dalt, int index, char *insn_str,
 	return 0;
 }
 
+/*
+ * Disassemble an exception table alternative.
+ */
+static int disas_alt_extable(struct disas_alt *dalt)
+{
+	struct instruction *alt_insn;
+	char *str;
+
+	alt_insn = dalt->alt->insn;
+	str = strfmt("resume at 0x%lx <%s+0x%lx>",
+		     alt_insn->offset, alt_insn->sym->name,
+		     alt_insn->offset - alt_insn->sym->offset);
+	if (!str)
+		return -1;
+
+	disas_alt_add_insn(dalt, 0, str, 0);
+
+	return 1;
+}
+
 /*
  * Disassemble an alternative and store instructions in the disas_alt
  * structure. Return the number of instructions in the alternative.
@@ -730,12 +763,16 @@ static void *disas_alt(struct disas_context *dctx,
 			goto error;
 
 		/*
-		 * Only group alternatives are supported at the moment.
+		 * Only group alternatives and exception tables are
+		 * supported at the moment.
 		 */
 		switch (dalt->alt->type) {
 		case ALT_TYPE_INSTRUCTIONS:
 			count = disas_alt_group(dctx, dalt);
 			break;
+		case ALT_TYPE_EX_TABLE:
+			count = disas_alt_extable(dalt);
+			break;
 		default:
 			count = 0;
 		}
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ