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: <2aefb1817980e30ec3ff3803eb0236a87d17c26a.1592510545.git.mhelsley@vmware.com>
Date:   Thu, 18 Jun 2020 13:38:24 -0700
From:   Matt Helsley <mhelsley@...are.com>
To:     <linux-kernel@...r.kernel.org>
CC:     Josh Poimboeuf <jpoimboe@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Julien Thierry <jthierry@...hat.com>,
        Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
        Matt Helsley <mhelsley@...are.com>
Subject: [RFC][PATCH v5 38/51] objtool: mcount: mcount symbol name simplification

Remove gpfx -- the recognized prefix for the mcount symbol
-- and just recognize any of the prefixes. This allows us
to further substitute the various strings directly into the
code rather than using variables.

Signed-off-by: Matt Helsley <mhelsley@...are.com>
---
 tools/objtool/mcount.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c
index 7e621769c488..4d6596a031bf 100644
--- a/tools/objtool/mcount.c
+++ b/tools/objtool/mcount.c
@@ -43,7 +43,6 @@
 
 #define R_ARM_THM_CALL		10
 
-static char gpfx;	/* prefix for global symbol name (sometimes '_') */
 extern int warn_on_notrace_sect; /* warn when section has mcount not being recorded */
 
 static struct elf *lf;
@@ -166,14 +165,16 @@ static struct symbol *get_mcount_sym(struct reloc *reloc)
 {
 	struct symbol *sym = reloc->sym;
 	char const *symname = sym->name;
-	char const *mcount = gpfx == '_' ? "_mcount" : "mcount";
-	char const *fentry = "__fentry__";
 
 	if (symname[0] == '.')
-		++symname;  /* ppc64 hack */
-	if (strcmp(mcount, symname) == 0 ||
+		symname++;  /* ppc64 hack */
+
+	if (symname[0] == '_')
+		symname++;
+
+	if (strcmp("mcount", symname) == 0 ||
 	    (strcmp("__gnu_mcount_nc", symname) == 0) ||
-	    (strcmp(fentry, symname) == 0))
+	    (strcmp("_fentry__", symname) == 0))
 		return sym;
 	return NULL;
 }
@@ -550,7 +551,6 @@ static int do_file(char const *const fname)
 		goto out;
 	}
 
-	gpfx = '_';
 	switch (lf->ehdr.e_machine) {
 	default:
 		fprintf(stderr, "unrecognized e_machine %u %s\n",
@@ -562,14 +562,12 @@ static int do_file(char const *const fname)
 		make_nop = make_nop_x86;
 		ideal_nop = ideal_nop5_x86_32;
 		mcount_adjust = -1;
-		gpfx = 0;
 		break;
 	case EM_ARM:
 		reltype = R_ARM_ABS32;
 		make_nop = make_nop_arm;
 		rel_type_nop = R_ARM_NONE;
 		is_fake_mcount = arm_is_fake_mcount;
-		gpfx = 0;
 		break;
 	case EM_AARCH64:
 		reltype = R_AARCH64_ABS64;
@@ -582,7 +580,7 @@ static int do_file(char const *const fname)
 	case EM_PPC:	reltype = R_PPC_ADDR32; break;
 	case EM_PPC64:	reltype = R_PPC64_ADDR64; break;
 	case EM_S390:	/* reltype: e_class    */ break;
-	case EM_SH:	reltype = R_SH_DIR32; gpfx = 0; break;
+	case EM_SH:	reltype = R_SH_DIR32;  break;
 	case EM_SPARCV9: reltype = R_SPARC_64; break;
 	case EM_X86_64:
 		make_nop = make_nop_x86;
@@ -590,7 +588,6 @@ static int do_file(char const *const fname)
 		reltype = R_X86_64_64;
 		rel_type_nop = R_X86_64_NONE;
 		mcount_adjust = -1;
-		gpfx = 0;
 		break;
 	}  /* end switch */
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ