From: Jiri Olsa <jolsa@redhat.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
paulus@samba.org, cjashfor@linux.vnet.ibm.com,
fweisbec@gmail.com, eranian@google.com, gorcunov@openvz.org,
tzanussi@gmail.com, mhiramat@redhat.com, rostedt@goodmis.org,
robert.richter@amd.com, linux-kernel@vger.kernel.org,
mjw@redhat.com
Subject: Re: [PATCH 04/15] perf: Add ability to dump user regs
Date: Wed, 28 Mar 2012 16:20:21 +0200 [thread overview]
Message-ID: <20120328142021.GC1647@m.brq.redhat.com> (raw)
In-Reply-To: <20120328140115.GE4826@redhat.com>
On Wed, Mar 28, 2012 at 10:01:15AM -0400, Frank Ch. Eigler wrote:
> Hi, Jiri -
>
> On Wed, Mar 28, 2012 at 02:35:47PM +0200, Jiri Olsa wrote:
> > [...]
> > The register value here are those of the user space context as
> > it was before the user entered the kernel for whatever reason
> > (syscall, irq, exception, or a PMI happening in userspace).
> > [...]
>
> As I understand the situation, there is a complication here that you
> haven't accounted for. Upon a normal syscall entry to the kernel, not
> all user registers are saved explicitly for such easy retrieval. The
> others may be spilled to the stack by gcc during the various sys_*
> functions or elsewhere. It turns out that some of these saved
> registers are sometimes necessary to accomplish a user-space unwind.
Are you reffering to x86_64 where only portion of registers
is stored by SAVE_ARGS macro? Seems like 32 bits stores the
whole pt_regs.
Generally you could need all the registers to start the unwind,
but I was assuming that for most cases the stack pointer and
instruction pointer should be enough.. but I might be wrong here.
>
> To recover these registers at run time, we found that the kernel stack
> itself has to be partially unwound - and not via frame pointers, but
> the full dwarf unwind/cfi machinery. This RFC code does not appear
> aware of the difference between the explicitly saved and the
> incidentally-spilled registers, and thus may accidentally pass garbage
> data to perf userspace. Correcting this could require a kernel-space
> libunwind.
AFAIK not going to happen any time soon ;)
thanks,
jirka
next prev parent reply other threads:[~2012-03-28 14:21 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 12:35 [RFC 00/15] perf: Add backtrace post dwarf unwind Jiri Olsa
2012-03-28 12:35 ` [PATCH 01/15] perf, tool: Fix the array pointer to follow event data properly Jiri Olsa
2012-03-28 12:35 ` [PATCH 02/15] uaccess: Add new copy_from_user_gup API Jiri Olsa
2012-03-28 12:35 ` [PATCH 03/15] perf: Unified API to record selective sets of arch registers Jiri Olsa
2012-03-30 12:51 ` Cyrill Gorcunov
2012-03-30 13:01 ` Jiri Olsa
2012-03-28 12:35 ` [PATCH 04/15] perf: Add ability to dump user regs Jiri Olsa
2012-03-28 14:01 ` Frank Ch. Eigler
2012-03-28 14:20 ` Jiri Olsa [this message]
2012-03-28 15:12 ` Frank Ch. Eigler
2012-03-28 16:01 ` Jiri Olsa
2012-03-28 16:10 ` Frederic Weisbecker
2012-03-28 16:06 ` Frederic Weisbecker
2012-03-28 17:02 ` Jiri Olsa
2012-03-28 21:41 ` Frederic Weisbecker
2012-03-30 14:42 ` Frederic Weisbecker
2012-03-28 12:35 ` [PATCH 05/15] perf: Add ability to dump part of the user stack Jiri Olsa
2012-03-28 12:35 ` [PATCH 06/15] perf: Add attribute to filter out user callchains Jiri Olsa
2012-03-28 12:35 ` [PATCH 07/15] perf, tool: Factor DSO symtab types to generic binary types Jiri Olsa
2012-03-28 12:35 ` [PATCH 08/15] perf, tool: Add interface to read DSO image data Jiri Olsa
2012-03-28 12:35 ` [PATCH 09/15] perf, tool: Add '.note' check into search for NOTE section Jiri Olsa
2012-03-28 12:35 ` [PATCH 10/15] perf, tool: Back [vdso] DSO with real data Jiri Olsa
2012-03-28 12:35 ` [PATCH 11/15] perf, tool: Add interface to arch registers sets Jiri Olsa
2012-03-28 12:35 ` [PATCH 12/15] perf, tool: Add libunwind dependency for dwarf cfi unwinding Jiri Olsa
2012-03-28 12:35 ` [PATCH 13/15] perf, tool: Support user regs and stack in sample parsing Jiri Olsa
2012-03-28 12:35 ` [PATCH 14/15] perf, tool: Support for dwarf cfi unwinding on post processing Jiri Olsa
2012-03-28 12:35 ` [PATCH 15/15] perf, tool: Support for dwarf mode callchain on perf record Jiri Olsa
2012-03-29 17:04 ` [RFC 00/15] perf: Add backtrace post dwarf unwind Stephane Eranian
2012-03-29 23:59 ` Peter Zijlstra
2012-03-30 0:38 ` Stephane Eranian
2012-03-30 0:44 ` Peter Zijlstra
2012-03-30 0:52 ` Stephane Eranian
2012-03-30 7:25 ` Robert Richter
2012-03-30 12:10 ` Masami Hiramatsu
2012-03-30 13:46 ` Ulrich Drepper
2012-03-30 17:54 ` Stephane Eranian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120328142021.GC1647@m.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=eranian@google.com \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=mjw@redhat.com \
--cc=paulus@samba.org \
--cc=robert.richter@amd.com \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox