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: <5edc3b938d5c234b012227699f12e6f3980094b8.1592510545.git.mhelsley@vmware.com>
Date:   Thu, 18 Jun 2020 13:38:29 -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 43/51] objtool: check: Use class to recognize kcov calls

Suggested-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Matt Helsley <mhelsley@...are.com>
---
 tools/objtool/check.c | 3 +--
 tools/objtool/elf.c   | 7 +++++++
 tools/objtool/elf.h   | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 78375908acda..d08714b878c5 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -771,8 +771,7 @@ static int add_call_destinations(struct objtool_file *file)
 		 * so they need a little help, NOP out any KCOV calls from noinstr
 		 * text.
 		 */
-		if (insn->sec->noinstr &&
-		    !strncmp(insn->call_dest->name, "__sanitizer_cov_", 16)) {
+		if (insn->sec->noinstr && insn->call_dest->class == SYM_KCOV) {
 			if (reloc) {
 				reloc->type = R_NONE;
 				elf_write_reloc(file->elf, reloc);
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index d55d8fef11b4..666cbc01c332 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -402,6 +402,11 @@ static bool is_mcount_sym(const char *name)
 	return false;
 }
 
+static bool is_kcov_symbol(const char *name)
+{
+	return !strncmp(name, "__sanitize_cov_", 16);
+}
+
 static int read_symbols(struct elf *elf)
 {
 	struct section *symtab, *symtab_shndx, *sec;
@@ -473,6 +478,8 @@ static int read_symbols(struct elf *elf)
 
 		if (is_mcount_sym(sym->name))
 			sym->class = SYM_MCOUNT;
+		else if (is_kcov_symbol(sym->name))
+			sym->class = SYM_KCOV;
 
 		sym->offset = sym->sym.st_value;
 		sym->len = sym->sym.st_size;
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index 13935edaff54..f0b02824f9d3 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -45,6 +45,7 @@ struct section {
 enum symbol_class {
 	SYM_REGULAR = 0,
 	SYM_MCOUNT = 1,
+	SYM_KCOV = 2,
 };
 
 struct symbol {
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ