Bug 652858

Summary: misaddresed user-space probes on prelinked shared libraries on i686 (REL)
Product: Red Hat Enterprise Linux 6 Reporter: Roland McGrath <roland>
Component: elfutilsAssignee: Petr Machata <pmachata>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: high Docs Contact:
Priority: low    
Version: 6.0CC: drepper, ebachalo, fche, fnadge, mjw, mnewsome, pmuller, snagar
Target Milestone: rcKeywords: Rebase, Regression
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: elfutils-0.152-1.el6 Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
Cause After prelink has been used on the system, attempting to use systemtap user-space probes that target functions or statements in certain shared libraries or executables based on separate debuginfo will resolve to the wrong PC location in a prelinked binary. Consequence The intended probes will fail to fire at the correct place in the program, and the program may crash or misbehave due to a corrupted instruction sequence resulting from incorrect breakpoint insertion. Fix The libdwfl (libdw.so) library code was adjusted to use more reliable methods of compensating for prelink's effect on the address layout of a binary when aligning a runtime PC address with an address computed from the separate debuginfo file. Result The systemtap probes work the same on prelinked binaries as they do on the same binaries when they have not been adjusted by prelink.
Story Points: ---
Clone Of: 646871 Environment:
Last Closed: 2011-05-19 13:13:33 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: 652857    
Bug Blocks: 646871    

Description Roland McGrath 2010-11-13 00:57:37 UTC
+++ This bug was initially created as a clone of Bug #646871 +++

+++ This bug was initially created as a clone of Bug #646870 +++

Due to a suspected problem in the way systemtap/elfutils
compute PC addresses to place int3 probe breakpoints into
prelinked shared libraries, sometimes the wrong instruction
is modified.  This can lead to lost probes, or segmentation
violations, or more subtle errors.  This problem appears to
exist in all versions of systemtap.

"prelink -u /usr/lib/libFOO.so" corrects the miscalculations,
as a temporary workaround.

This issue is being tracked upstream at
http://sourceware.org/bugzilla/show_bug.cgi?id=12141

Comment 1 Roland McGrath 2010-11-13 00:59:59 UTC
The bug is actually in elfutils, affecting systemtap.
Bug #646871 tracks systemtap state of it, can be closed as DUP of this one if we get a proper elfutils update in the same target milestone.

Comment 2 Roland McGrath 2010-11-23 22:04:40 UTC
This is fixed in elfutils-0.150, released upstream and pending in Fedora updates.

Comment 6 Roland McGrath 2011-01-13 01:24:01 UTC
0.151 is built in brew.

Comment 12 Roland McGrath 2011-02-02 19:58:35 UTC
We have found another related case (same bug/code, just different test case to hit this variant of it) that is a regression (vs 6.0) introduced by this fix.  https://bugzilla.redhat.com/show_bug.cgi?id=674465 is the Fedora bug for the new case.  We will respin this rebase to fix the regression.

Comment 14 Petr Muller 2011-02-02 20:24:14 UTC
Yes, I have seen the issue in systemtap upstream. It's already incorporated into the test.

Comment 15 Florian Nadge 2011-03-01 11:10:01 UTC
Please be so kind and add a few key words to the technical note of this
bugzilla entry using the following structure:

Cause:

Consequence:

Fix:

Result:


For details, see:
https://bugzilla.redhat.com/page.cgi?id=fields.html#cf_release_notes

Thanks

Comment 16 Florian Nadge 2011-03-01 11:10:02 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    What actions or circumstances cause this bug to present.
Consequence
    What happens when the bug presents.
Fix
    What was done to fix the bug.
Result
    What now happens when the actions or circumstances above occur.
    Note: this is not the same as the bug doesn’t present anymore.

Comment 17 Roland McGrath 2011-03-01 19:46:03 UTC
Details written in Technical Notes field.

Comment 18 Roland McGrath 2011-03-01 19:46:03 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,9 +1,8 @@
 Cause
-    What actions or circumstances cause this bug to present.
+    After prelink has been used on the system, attempting to use systemtap user-space probes that target functions or statements in certain shared libraries or executables based on separate debuginfo will resolve to the wrong PC location in a prelinked binary.
 Consequence
-    What happens when the bug presents.
+    The intended probes will fail to fire at the correct place in the program, and the program may crash or misbehave due to a corrupted instruction sequence resulting from incorrect breakpoint insertion.
 Fix
-    What was done to fix the bug.
+    The libdwfl (libdw.so) library code was adjusted to use more reliable methods of compensating for prelink's effect on the address layout of a binary when aligning a runtime PC address with an address computed from the separate debuginfo file.
 Result
-    What now happens when the actions or circumstances above occur.
+    The systemtap probes work the same on prelinked binaries as they do on the same binaries when they have not been adjusted by prelink.-    Note: this is not the same as the bug doesn’t present anymore.

Comment 20 errata-xmlrpc 2011-05-19 13:13:33 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-2011-0578.html