Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 536807

Summary: para-callgraph.stp fails in pass 4 with ‘s0’ is used uninitialized in this function
Product: Red Hat Enterprise Linux 5 Reporter: Adrien Kunysz <akunysz>
Component: systemtapAssignee: Frank Ch. Eigler <fche>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: mjw, pmuller
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-30 09:06:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 515829    
Bug Blocks:    
Attachments:
Description Flags
generated C file none

Description Adrien Kunysz 2009-11-11 13:31:53 UTC
# stap -k --vp 1144 para-callgraph.stp 'process("/usr/lib/httpd/modules/libphp5.so").function("*")' -c 'php -h'
[...]cc1: warnings being treated as errorsrobe_1749 probe_1747 probe_1746 probe_1743 

/tmp/stapqozr9O/stap_14826.c: In function ‘probe_1737’:
/tmp/stapqozr9O/stap_14826.c:12258: warning: ‘s0’ is used uninitialized in this function
[...]
make[1]: *** [/tmp/stapqozr9O/stap_14826.o] Error 1
make: *** [_module_/tmp/stapqozr9O] Error 2
make: Leaving directory `/usr/src/kernels/2.6.18-164.6.1.el5-i686'
Pass 4: compiled C into "stap_14826.ko" in 27390usr/29470sys/54946real ms.
Pass 4: compilation failed.  Try again with another '--vp 0001' option.
Keeping temporary directory "/tmp/stapqozr9O"

Looking at /tmp/stapqozr9O/stap_14826.c:
 12246     uint32_t addr;
 12247     { // DWARF expression: 0x75(-40)
 12248       {
 12249         intptr_t s0;
 12250         s0 = fetch_register (5) + -40L;
 12251         addr = s0;
 12252       }
 12253     }
 12254     { int32_t value = deref (4, addr);u.pieces.p0 = value; }
 12255     { // DWARF expression: 0x51
 12256       {
 12257         intptr_t s0;
 12258         addr = s0;
 12259       }
 12260     }
 12261     { int32_t value = deref (4, addr);u.pieces.p4 = value; }
 12262     THIS->__retvalue = u.whole;
 12263   }
 12264   goto out;

It seems something is missing between lines 12257 and 12258. This looks like a bug in the way the code is generated to me although I am not able to dig deeper at the moment.

Versions for relevant packages (should be latest RHEL 5):

# rpm -qa | egrep 'systemtap|kernel|gcc|php'
php-devel-5.1.6-23.2.el5_3
libgcc-4.1.2-46.el5_4.1
kernel-doc-2.6.18-164.el5
php-pear-1.4.9-6.el5
gcc-4.1.2-46.el5_4.1
php-ldap-5.1.6-23.2.el5_3
php-mysql-5.1.6-23.2.el5_3
kernel-headers-2.6.18-164.6.1.el5
php-cli-5.1.6-23.2.el5_3
php-pdo-5.1.6-23.2.el5_3
kernel-2.6.18-164.6.1.el5
systemtap-0.9.7-5.el5
gcc-c++-4.1.2-46.el5_4.1
php-common-5.1.6-23.2.el5_3
systemtap-runtime-0.9.7-5.el5
php-5.1.6-23.2.el5_3
php-debuginfo-5.1.6-23.2.el5_3
kernel-devel-2.6.18-164.6.1.el5
# uname -a
Linux [hostname] 2.6.18-164.6.1.el5 #1 SMP Tue Oct 27 11:30:06 EDT 2009 i686 i686 i386 GNU/Linux

Comment 1 Adrien Kunysz 2009-11-11 13:35:08 UTC
Created attachment 369025 [details]
generated C file

Comment 2 Frank Ch. Eigler 2009-11-11 14:35:27 UTC
This loc2c error comes from accessing the variable $amount

 140173   { .finder = {}, .pathname="/usr/lib/httpd/modules/libphp5.so", .address=(unsigned long)0x 140173 74720ULL, .pp="process(\"/usr/lib/httpd/modules/libphp5.so\").function(\"timelib_set_relativ 140173 e@/usr/src/debug/php-5.1.6/ext/date/lib/parse_date.c:591\").call", .ph=&probe_1737, },

It is of type "timelib_sll" which is supposed to be a signed long long.

This seems to match <http://sources.redhat.com/bugzilla/show_bug.cgi?id=6979>.

Comment 3 Frank Ch. Eigler 2009-11-11 14:58:27 UTC
Simpler reproduction:  rhel5 php (0:5.1.6-23.2.el5_3), i686, git systemtap:

% stap -p2 -e 'probe process("/usr/lib/httpd/modules/libphp5.so").function("timelib_set_relative") {log($$parms)}'
# functions
_dwarf_tvar_get_amount_1:long ()
_dwarf_tvar_get_behavior_2:long ()
_dwarf_tvar_get_ptr_0:long ()
_dwarf_tvar_get_s_3:long ()
log:unknown (msg:string)
# probes
process("/usr/lib/httpd/modules/libphp5.so").function("timelib_set_relative@/usr/src/debug/php-5.1.6/ext/date/lib/parse_date.c:591") /* pc=.dynamic+0x74720 */ /* <- process("/usr/lib/httpd/modules/libphp5.so").function("timelib_set_relative") */

% ./loc2c-test -e /usr/lib/httpd/modules/libphp5.so 0x74720 amount
...
  intptr_t value;
  {
    union {
      char bytes[8];
      struct {
        uint32_t p0;
        uint32_t p4;
      } pieces __attribute__ ((packed));
      uint64_t whole;
    } u_pieces;
    uint32_t addr;
    { // DWARF expression: 0x75(-40)
      {
        intptr_t s0;

        s0 = fetch_register (5) + -40L;
        addr = s0;
      }
    }
    { int32_t value = deref (4, addr);u_pieces.pieces.p0 = value; }
    { // DWARF expression: 0x51
      {
        intptr_t s0;
        addr = s0;
      }
    }
    { int32_t value = deref (4, addr);u_pieces.pieces.p4 = value; }
...

Comment 4 Frank Ch. Eigler 2009-11-11 22:58:21 UTC
Patch in hand, will be included in RHEL5.5 rebase.

Comment 10 errata-xmlrpc 2010-03-30 09:06:20 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0308.html