This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

uprobes and empty functions


Srikar,

I need some uprobes help.  I started working on bz640097
(<https://bugzilla.redhat.com/show_bug.cgi?id=640097>), and hoped it was
the same problem I was seeing with the new dtrace_vfork_exec.exp test
(which I believe I've just fixed in uprobes2/uprobes.c).  Unfortunately,
it wasn't the same problem.

You can use the reproducer included in that bug, or I've also attached a
much smaller test.  Here's how to use it:

Terminal 1:
# stap -v shelly-stressor-simple.stp `which bash` `which zsh`

Terminal 2:
# zsh -c ls

You'll get 'Segmentation fault (core dumped)'.  If you run zsh under
gdb, you'll get:

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff7ffd020 in ?? ()

That address doesn't look valid at all.

The simple reproducer just probes 2 functions in zsh, nohw() and
nohwe().  In the source, both of these functions are completely empty,
so they end up looking like:

   0x0000000000434ec0 <+0>:	 f3 c3	repz retq

Josh helped me look at uprobes2/uprobes_x86.c, and it looks like repz/f3
is in the section with the comment "opcodes we may need to refine
support for".  It may be time for some refining...

If we're following this code correctly, check_legacy_prefix() will cause
the repz/f3 to get skipped.  Then later in uprobe_post_ssout() there is
a fixup for retq/c3, but there is a comment that reads:

	 * We don't bother skipping prefixes here because none of the
	 * instructions that require special treatment (other than
	 * rip-relative instructions, handled above) involve prefixes.

Josh believes the fixup is adding correction to the ip, but it shouldn't
because a ret already sets an ip away from the ssol area.

Do you see what is going wrong here?

Thanks for the help.

P.S.  I took a look at v11 of the new uprobes code, and didn't see
anything substantially new in this area, so it is possible the new code
has a similar problem.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

Attachment: shelly-stressor-simple.stp
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]