public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/18936] New: script cache will fail if $jiffies is referenced
@ 2015-09-08 20:03 dsmith at redhat dot com
  2015-09-08 20:53 ` [Bug translator/18936] " jistone at redhat dot com
  2015-09-08 21:29 ` jistone at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dsmith at redhat dot com @ 2015-09-08 20:03 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18936

            Bug ID: 18936
           Summary: script cache will fail if $jiffies is referenced
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: dsmith at redhat dot com
  Target Milestone: ---

I saw this on a RHEL7 x86_64 system:

====
# # start with a clean cache
# rm -rf ~/.systemtap.cache
# # compile a script (same as testsuite/buildok/pr13284.stp)
# stap -vp4 -e 'probe kernel.function("schedule_timeout") { println($jiffies)
}'
Pass 1: parsed user script and 113 library script(s) using
219172virt/32280res/3112shr/29500data kb, in 620usr/50sys/662real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s)
using 253912virt/67892res/3960shr/64240data kb, in 1170usr/130sys/1304real ms.
Pass 3: translated to C into
"/tmp/stapcC0UrM/stap_48e8457a3acdccca58a072ce28c0dcc9_1925_src.c" using
253912virt/68240res/4308shr/64240data kb, in 20usr/80sys/101real ms.
/home/dsmith/.systemtap/cache/48/stap_48e8457a3acdccca58a072ce28c0dcc9_1925.ko
Pass 4: compiled C into "stap_48e8457a3acdccca58a072ce28c0dcc9_1925.ko" in
11290usr/2230sys/13840real ms.
# # compile the script again
# stap -vp4 -e 'probe kernel.function("schedule_timeout") { println($jiffies)
}'
Pass 1: parsed user script and 113 library script(s) using
219172virt/32280res/3112shr/29500data kb, in 650usr/30sys/688real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s)
using 253912virt/67892res/3960shr/64240data kb, in 1190usr/150sys/1331real ms.
Pass 3: translated to C into
"/tmp/stapKnmi7U/stap_3763a751bb95c90049e7dcbf9a949d14_1925_src.c" using
253912virt/68240res/4308shr/64240data kb, in 10usr/90sys/778real ms.
/home/dsmith/.systemtap/cache/37/stap_3763a751bb95c90049e7dcbf9a949d14_1925.ko
Pass 4: compiled C into "stap_3763a751bb95c90049e7dcbf9a949d14_1925.ko" in
2610usr/630sys/3051real ms.
# diff -u
/home/dsmith/.systemtap/cache/48/stap_48e8457a3acdccca58a072ce28c0dcc9_1925.c
/home/dsmith/.systemtap/cache/37/stap_3763a751bb95c90049e7dcbf9a949d14_1925.c
---
/home/dsmith/.systemtap/cache/48/stap_48e8457a3acdccca58a072ce28c0dcc9_1925.c  
    2015-09-08 14:45:31.050480484 -0500
+++
/home/dsmith/.systemtap/cache/37/stap_3763a751bb95c90049e7dcbf9a949d14_1925.c  
    2015-09-08 14:45:42.426228745 -0500
@@ -161,7 +161,7 @@
 {
   {
     uintptr_t addr;
-    { // DWARF expression: 0xd1(57956440,61661464)
+    { // DWARF expression: 0xd1(56842328,60547352)
       {
         uintptr_t s0;
         s0 = ({ static unsigned long addr = 0; if (addr==0) addr =
_stp_kmodule_relocate ("kernel","_stext",0xa70e38); addr; });
====

So, this comment is causing the script to have 2 different hash values.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/18936] script cache will fail if $jiffies is referenced
  2015-09-08 20:03 [Bug translator/18936] New: script cache will fail if $jiffies is referenced dsmith at redhat dot com
@ 2015-09-08 20:53 ` jistone at redhat dot com
  2015-09-08 21:29 ` jistone at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2015-09-08 20:53 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18936

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jistone at redhat dot com

--- Comment #1 from Josh Stone <jistone at redhat dot com> ---
I found that dwflpp::literal_stmt_for_local is passing the address of stack
variable "addr_loc" into c_translate_location(), which eventually saves that
into loc->ops.  By the time this is used by emit_header(), via
express_as_string(), that addr_loc has gone out of scope and is clobbered on
the stack.

If we lift addr_loc to the top of the function, it will live long enough for
emit_header() to comment it correctly.

-- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -3860,6 +3860,7 @@ dwflpp::literal_stmt_for_local (vector<Dwarf_Die>&
scopes,
                                 bool lvalue,
                                 Dwarf_Die *die_mem)
 {
+  Dwarf_Op addr_loc;
   Dwarf_Die vardie;
   Dwarf_Attribute fb_attr_mem, *fb_attr = NULL;

@@ -3890,7 +3891,6 @@ dwflpp::literal_stmt_for_local (vector<Dwarf_Die>&
scopes,
   if (dwarf_attr_integrate (&vardie, DW_AT_const_value, &attr_mem) == NULL
       && dwarf_attr_integrate (&vardie, DW_AT_location, &attr_mem) == NULL)
     {
-      Dwarf_Op addr_loc;
       memset(&addr_loc, 0, sizeof(Dwarf_Op));
       addr_loc.atom = DW_OP_addr;
       // If it is an external variable try the symbol table. PR10622.


Now I get a consistent "// DWARF expression: 0x3(-2118082560)", which is
DW_OP_addr with the relative address.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/18936] script cache will fail if $jiffies is referenced
  2015-09-08 20:03 [Bug translator/18936] New: script cache will fail if $jiffies is referenced dsmith at redhat dot com
  2015-09-08 20:53 ` [Bug translator/18936] " jistone at redhat dot com
@ 2015-09-08 21:29 ` jistone at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2015-09-08 21:29 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=18936

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Josh Stone <jistone at redhat dot com> ---
commit 68619b611c1e77274acbc552a82f41be4dfa1b5a

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-08 21:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-08 20:03 [Bug translator/18936] New: script cache will fail if $jiffies is referenced dsmith at redhat dot com
2015-09-08 20:53 ` [Bug translator/18936] " jistone at redhat dot com
2015-09-08 21:29 ` jistone at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).