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]
Date:	Thu, 30 Apr 2015 10:52:34 +0000
From:	Wang Nan <wangnan0@...wei.com>
To:	<ast@...mgrid.com>, <davem@...emloft.net>, <acme@...nel.org>,
	<mingo@...hat.com>, <a.p.zijlstra@...llo.nl>,
	<masami.hiramatsu.pt@...achi.com>, <jolsa@...nel.org>
CC:	<lizefan@...nel.org>, <linux-kernel@...r.kernel.org>,
	<pi3orama@....com>, <hekuang@...wei.com>
Subject: [RFC PATCH 11/22] perf bpf: collect symbol table in object files.

This patch collects symbols section. This section is useful when
linking ELF maps.

Signed-off-by: Wang Nan <wangnan0@...wei.com>
---
 tools/perf/util/bpf-loader.c | 11 +++++++++++
 tools/perf/util/bpf-loader.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index b913d6f..b9c701a 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -50,6 +50,9 @@ static void bpf_obj_clear_elf(struct bpf_obj *obj)
 		elf_end(obj->elf.elf);
 		obj->elf.elf = NULL;
 	}
+	
+	obj->elf.symbols = NULL;
+
 	if (obj->elf.fd >= 0) {
 		close(obj->elf.fd);
 		obj->elf.fd = -1;
@@ -312,6 +315,14 @@ static int bpf_obj_elf_collect(struct bpf_obj *obj)
 		else if (strcmp(name, "config") == 0)
 			err = bpf_obj_config_init(obj, data->d_buf,
 						  data->d_size);
+		else if (sh.sh_type == SHT_SYMTAB) {
+			if (obj->elf.symbols) {
+				pr_err("bpf: multiple SYMTAB in %s\n",
+					obj->path);
+				err = -EEXIST;
+			} else
+				obj->elf.symbols = data;
+		}
 		if (err)
 			goto out;
 	}
diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h
index 086f28d..f0b573c 100644
--- a/tools/perf/util/bpf-loader.h
+++ b/tools/perf/util/bpf-loader.h
@@ -38,6 +38,7 @@ struct bpf_obj {
 		int fd;
 		Elf *elf;
 		GElf_Ehdr ehdr;
+		Elf_Data *symbols;
 	} elf;
 };
 #define obj_elf_valid(o)	((o)->elf.fd >= 0)
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ