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:	Mon, 3 Aug 2015 19:41:13 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Borislav Petkov <bp@...e.de>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Stephane Eranian <eranian@...gle.com>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 11/18] perf script: Switch from perf.data's kallsyms to
 perf's symbol resolver

On Thu, Jul 23, 2015 at 10:58:24PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@...hat.com>
> 
> We were storing a copy of kallsyms inside perf.data file so that we
> could resolve kernel addresses to function (start, name, mod) tuples,
> but that can be achieved using the symbol resolving routines we have
> in symbols.c, and that are used elsewhere in tools/perf.
> 
> So, do just like 'perf trace' did and ask libtraceevent to use perf's
> symbol resolution routines.
> 
> The next step is to just skip whatever kallsyms data is embedded in
> older perf.data files and finally to stop storing kallsyms in the perf
> data file, as the 20-bytes build-id stored in perf.data's header is
> enough to find out the right symtab (be it ELF, kcore, kallsyms, etc) to
> use.
> 
> Acked-by: David Ahern <dsahern@...il.com>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Borislav Petkov <bp@...e.de>
> Cc: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Stephane Eranian <eranian@...gle.com>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Link: http://lkml.kernel.org/n/tip-d0rtb8tk9j72pz0ehw5fnp24@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> ---
>  tools/perf/builtin-script.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 24809787369f..2777c6444bc3 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -1830,6 +1830,13 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>  	else
>  		symbol_conf.use_callchain = false;
>  
> +	if (pevent_set_function_resolver(session->tevent.pevent,
> +					 machine__resolve_kernel_addr,
> +					 &session->machines.host) < 0) {
> +		pr_err("%s: failed to set libtraceevent function resolver\n", __func__);
> +		return -1;
> +	}
> +

got segfault because of this:

    [jolsa@...va perf]$ ./perf record ls
    [ perf record: Woken up 1 times to write data ]
     
    SNIP
     
    /proc/kcore requires CAP_SYS_RAWIO capability to access.
    [ perf record: Captured and wrote 0.016 MB perf.data (7 samples) ]
    [jolsa@...va perf]$ ./perf script
    Segmentation fault (core dumped)
     
    [jolsa@...va perf]$ gdb ./perf
    GNU gdb (GDB) Fedora 7.9.1-17.fc22
    Copyright (C) 2015 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-redhat-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ./perf...done.
    (gdb) r script
    Starting program: /home/jolsa/kernel/linux-perf/tools/perf/perf script
    Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-7.fc22.x86_64
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    Detaching after fork from child process 11230.
     
    Program received signal SIGSEGV, Segmentation fault.
    0x00000000004eeace in pevent_set_function_resolver (pevent=0x0, func=0x4a3197 <machine__resolve_kernel_addr>, priv=0x18e1f48) at event-parse.c:464
    464             free(pevent->func_resolver);
    Missing separate debuginfos, use: dnf debuginfo-install audit-libs-2.4.3-1.fc22.x86_64 bzip2-libs-1.0.6-14.fc22.x86_64 elfutils-libelf-0.163-1.fc22.x86_64 elfutils-libs-0.163-1.fc22.x86_64 libunwind-1.1-10.fc22.x86_64 nss-softokn-freebl-3.19.2-1.0.fc22.x86_64 numactl-libs-2.0.10-2.fc22.x86_64 perl-libs-5.20.2-326.fc22.x86_64 python-libs-2.7.10-4.fc22.x86_64 slang-2.3.0-2.fc22.x86_64 xz-libs-5.2.0-2.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64
    (gdb)


I think 'session->tevent.pevent' gets initialized only for tracepoint, right?

jirka
--
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