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:	Wed, 30 Mar 2016 22:13:34 +0530
From:	"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To:	linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Cc:	Michael Ellerman <mpe@...erman.id.au>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Thiago Jung Bauermann <bauerman@...ux.vnet.ibm.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Subject: [RFC PATCH 2/2] tools/perf: Change how probe offsets are handled

While trying to address the kallsyms perf test failure on ppc64le,
Ananth noticed that we were not necessarily probing at the expected
address when an offset to the function was specified.

So far, we used to treat probe point offsets as being offset from the
LEP. However, userspace applications (objdump/readelf) always show
disassembly and offsets from the function GEP. This is confusing to the
user. Fix this by changing how we modify probe address with perf.

If only the function name is provided, we assume the user needs the LEP.
Otherwise, if an offset is specified, we assume that the user knows the
exact address to probe based on function disassembly, and so we just
place the probe from the GEP offset.

Tested lightly. Needs more testing.

Cc: Thiago Jung Bauermann <bauerman@...ux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Reported-by: Ananth N Mavinakayanahalli <ananth@...ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
---
 tools/perf/arch/powerpc/util/sym-handling.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c
index 3e98a61..36f6eb0 100644
--- a/tools/perf/arch/powerpc/util/sym-handling.c
+++ b/tools/perf/arch/powerpc/util/sym-handling.c
@@ -65,16 +65,23 @@ void arch__fix_tev_from_maps(struct perf_probe_event *pev,
 			     struct probe_trace_event *tev, struct map *map,
 			     struct symbol *sym)
 {
+	int lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other);
+
 	/*
 	 * ppc64 ABIv2 local entry point is currently always 2 instructions
-	 * (8 bytes) after the global entry point.
+	 * (8 bytes) after the global entry point. When probing at a function
+	 * entry point, we normally always want the LEP since that catches calls
+	 * to the function through both the GEP and the LEP. However, if the user
+	 * specifies an offset, we fall back to using the GEP since all userspace
+	 * applications (objdump/readelf) show function disassembly with offsets
+	 * from the GEP.
 	 */
-	if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
-		tev->point.address += PPC64LE_LEP_OFFSET;
+	if (pev->point.offset)
+		return;
+
+	if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS)
 		tev->point.offset += PPC64LE_LEP_OFFSET;
-	} else if (PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other)) {
-		tev->point.address += PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other);
-		tev->point.offset += PPC64_LOCAL_ENTRY_OFFSET(sym->elf_st_other);
-	}
+	else if (lep_offset)
+		tev->point.offset += lep_offset;
 }
 #endif
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ