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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87d2j43aav.fsf@sejong.aot.lge.com>
Date:	Mon, 03 Feb 2014 16:49:44 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	David Ahern <dsahern@...il.com>, linux-kernel@...r.kernel.org,
	"Steven Rostedt \(Red Hat\)" <rostedt@...dmis.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Ingo Molnar <mingo@...hat.com>,
	"David A. Long" <dave.long@...aro.org>,
	yrl.pp-manager.tt@...achi.com
Subject: Re: [PATCH -tip v2 4/8] perf-probe: Use _stext based address instead of the symbol name

On Wed, 29 Jan 2014 09:14:59 +0000, Masami Hiramatsu wrote:
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 4a9f43b..120954b 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -387,6 +387,44 @@ static int add_module_to_probe_trace_events(struct probe_trace_event *tevs,
>  	return ret;
>  }
>  
> +/* Post processing the probe events */
> +static int post_process_probe_trace_events(struct probe_trace_event *tevs,
> +					   int ntevs, const char *module,
> +					   bool uprobe)
> +{
> +	struct symbol *sym;
> +	struct map *map;
> +	unsigned long stext = 0;
> +	char *tmp;
> +	int i;
> +
> +	if (uprobe)
> +		return add_exec_to_probe_trace_events(tevs, ntevs, module);
> +
> +	/* Note that currently _stext based probe is not for drivers */
> +	if (module)
> +		return add_module_to_probe_trace_events(tevs, ntevs, module);
> +
> +	sym = __find_kernel_function_by_name("_stext", &map);

Couldn't we just use kmap->ref_reloc_sym instead of the hard-coded
"_stext"?  You might want to check the Adrian's recent kaslr fixes (now
in tip/perf/urgent).

Thanks,
Namhyung


> +	if (!sym) {
> +		pr_debug("Failed to find _stext. Use original symbol name.\n");
> +		return 0;
> +	}
> +	stext = map->unmap_ip(map, sym->start);
> +
> +	for (i = 0; i < ntevs; i++) {
> +		if (tevs[i].point.address) {
> +			tmp = strdup("_stext");
> +			if (!tmp)
> +				return -ENOMEM;
> +			free(tevs[i].point.symbol);
> +			tevs[i].point.symbol = tmp;
> +			tevs[i].point.offset = tevs[i].point.address - stext;
> +		}
> +	}
> +	return 0;
> +}
> +
--
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