lkml.org 
[lkml]   [2020]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ftrace not showing the process names for all processes on syscall events
On Mon, 30 Mar 2020 18:14:37 +0000
David Laight <David.Laight@ACULAB.COM> wrote:

> From: Steven Rostedt
> > Sent: 30 March 2020 19:08
> > On Mon, 30 Mar 2020 15:34:08 +0000
> > David Laight <David.Laight@ACULAB.COM> wrote:
> >
> > > Oh, does the 'function_graph' code ignore tail calls?
> >
> > Yes and no ;-) It works by dumb luck. As it was a year after function
> > graph tracing was live (some time in 2010 I believe) that someone brought
> > up tail calls, and I had to take a look at how it never crashed, and was
> > surprised that it "just worked". Here's a summary:
>
> 'Dumb luck' seems to be failing me :-)
> I'll look more closely tomorrow.

The tl;td; version is that the function graph tracer relies on a shadow
stack that it uses to save the original return address, as it replaces the
original return address with the address of the fgraph return trampoline.

Although a tail call causes the real stack to only contain one return
address, the shadow stack will contain a return address for every function,
even if it was a tail call. As that stack gets updated by the entry of the
function not the return side. The difference is, a tail call would cause
the shadow stack to just contain a call to the start of the fgraph return
trampoline, and not an address into the rest of the kernel.

-- Steve

\
 
 \ /
  Last update: 2020-03-30 20:40    [W:0.036 / U:1.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site