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: <cf3a0bb03cb666bf5e6360c2dbd3c5f102d01947.1592510545.git.mhelsley@vmware.com>
Date:   Thu, 18 Jun 2020 13:38:33 -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 47/51] objtool: mcount: Merge section mcount flags

One flag is only for relocation sections and the other only
for text (not relocation) sections so we can share the same
flag and test the section type when we need to.

Signed-off-by: Matt Helsley <mhelsley@...are.com>
---
 tools/objtool/elf.c    | 5 ++---
 tools/objtool/elf.h    | 2 +-
 tools/objtool/mcount.c | 9 ++++++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 3708f85fe36d..12bd889a62ba 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -384,8 +384,7 @@ static int read_sections(struct elf *elf)
 		}
 		sec->len = sec->sh.sh_size;
 
-		sec->mcounted = is_mcounted_section_name(sec->name);
-		sec->relocs_mcountable = false;
+		sec->mcountable = is_mcounted_section_name(sec->name);
 
 		list_add_tail(&sec->list, &elf->sections);
 		elf_hash_add(elf->section_hash, &sec->hash, sec->idx);
@@ -642,7 +641,7 @@ static int read_relocs(struct elf *elf)
 		}
 
 		sec->base->reloc = sec;
-		sec->relocs_mcountable = relocs_mcountable(sec);
+		sec->mcountable = relocs_mcountable(sec);
 
 		nr_reloc = 0;
 		for (i = 0; i < sec->sh.sh_size / sec->sh.sh_entsize; i++) {
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index 92d3e68abf59..fb10f470d1a4 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -39,7 +39,7 @@ struct section {
 	char *name;
 	int idx;
 	unsigned int len;
-	bool changed, text, rodata, noinstr, mcounted, relocs_mcountable;
+	bool changed, text, rodata, noinstr, mcountable;
 };
 
 enum symbol_class {
diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c
index 9cd52beed871..80daf0e17eab 100644
--- a/tools/objtool/mcount.c
+++ b/tools/objtool/mcount.c
@@ -279,7 +279,10 @@ static void tot_relsize(unsigned int *rel_entsize)
 	const struct section *sec;
 
 	list_for_each_entry(sec, &lf->sections, list) {
-		if (sec->relocs_mcountable)
+		if (sec->sh.sh_type != SHT_REL &&
+		    sec->sh.sh_type != SHT_RELA)
+			continue;
+		if (sec->mcountable)
 			*rel_entsize = sec->sh.sh_entsize;
 	}
 }
@@ -419,13 +422,13 @@ static int do_mcount(unsigned const reltype, size_t rela_size)
 		    sec->sh.sh_type != SHT_RELA)
 			continue;
 		/* Which may relocate mcount calls.. */
-		if (!sec->relocs_mcountable)
+		if (!sec->mcountable)
 			continue;
 		txts = sec->base;
 		if (!txts)
 			continue;
 
-		if (txts->mcounted) {
+		if (txts->mcountable) {
 			/* In mcountable text sections */
 			unsigned long recval = 0;
 			unsigned int recsym;
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ