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] [day] [month] [year] [list]
Message-ID: <20160331084226.GB17907@naverao1-tp.ibm.com>
Date:	Thu, 31 Mar 2016 14:12:26 +0530
From:	"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
To:	linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Cc:	Thiago Jung Bauermann <bauerman@...ux.vnet.ibm.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [RFC PATCH 2/2] tools/perf: Change how probe offsets are handled

On 2016/03/30 10:13PM, Naveen N Rao wrote:
> 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)

This needs to be:
	if (pev->point.offset || pev->point.retprobe)
		return;

kretprobes fails otherwise.


- Naveen

> +		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
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@...ts.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ