Bug 571437 - strace incorrectly shows the arguments of fadvise() in 32 bit compat programs
Summary: strace incorrectly shows the arguments of fadvise() in 32 bit compat programs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: strace
Version: 5.5
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jeff Law
QA Contact: Jeff Law
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-08 14:39 UTC by john.haxby@oracle.com
Modified: 2013-01-08 07:02 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-08 07:02:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (9.23 KB, patch)
2010-03-08 14:39 UTC, john.haxby@oracle.com
no flags Details | Diff
Program to demonstrate the bug (436 bytes, text/plain)
2012-04-03 15:50 UTC, john.haxby@oracle.com
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0010 0 normal SHIPPED_LIVE strace bug fix update 2013-01-07 15:30:12 UTC

Description john.haxby@oracle.com 2010-03-08 14:39:41 UTC
Created attachment 398536 [details]
Proposed patch

Description of problem:
  strace incorrectly shows the arguments of fadvise() in
  32 bit compat programs

Version-Release number of selected component (if applicable):
  strace-4.5.19-1.fc12.x86_64

How reproducible: Always


Steps to Reproduce:
1. Find a program that calls posix_fadvise(2).  My sample program calls
   posix_fadvise(2) like this:

        posix_fadvise(fd, 0, 0, POSIX_FADV_RANDOM);
        posix_fadvise(fd, 5, 7, POSIX_FADV_SEQUENTIAL);
        posix_fadvise64(fd, 0, 0, POSIX_FADV_RANDOM);
        posix_fadvise64(fd, 5, 7, POSIX_FADV_SEQUENTIAL);

   (The second and third arguments are only to illustrate the problem, they
    don't actually have any useful meaning.)

2. Compile it as a 32 bit application
3. Run under strace.

Actual results:
  fadvise64(3, 0, 0, POSIX_FADV_NORMAL)   = 0
  fadvise64(3, 5, 0, 0x7 /* POSIX_FADV_??? */) = 0
  fadvise64_64(3, 0, 0, POSIX_FADV_NORMAL) = 0
  fadvise64_64(3, 5, 0, 0x7 /* POSIX_FADV_??? */) = 0

Expected results:
  fadvise64(3, 0, 0, POSIX_FADV_RANDOM)   = 0
  fadvise64(3, 5, 7, POSIX_FADV_SEQUENTIAL) = 0
  fadvise64_64(3, 0, 0, POSIX_FADV_RANDOM) = 0
  fadvise64_64(3, 5, 7, POSIX_FADV_SEQUENTIAL) = 0


Additional info:
  I originally came across this problem when looking at the fadvise() compat
  syscall in bug 559410.  Having strace print rubbish doesn't help when you
  are trying to fix problems :-)

  The attached patch fixes this problem, it is based on this upstream commit:

    commit b5600fc3df0453ba11f254a9b49add3ffbec9733
    Author: Andreas Schwab <schwab>
    Date:   Wed Nov 4 17:08:34 2009 +0100

  (The changes are merely needed to make it apply cleanly.)

Comment 1 john.haxby@oracle.com 2010-03-08 14:43:28 UTC
See also bug 571432 (Fedora 12)

Comment 2 RHEL Program Management 2012-04-02 13:08:05 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 4 john.haxby@oracle.com 2012-04-03 11:53:12 UTC
This bug is marked NEEDINFO.  Do you need information from me?

It's a over two years since I filed this bug, but I can probably find whatever you need somewhere.

Comment 5 Jeff Law 2012-04-03 15:38:56 UTC
Michal, if John can't get you a test program it wouldn't be that hard to write our own.  All I think we have to do is open a file descriptor, then call fadvise on it like this


posix_fadvise (fd, 0, 0, POSIX_FADV_NORMAL);
posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
posix_fadvise (fd, 0, 0, POSIX_FADV_RANDOM);
posix_fadvise (fd, 0, 0, POSIX_FADV_NOREUSE);
posix_fadvise (fd, 0, 0, POSIX_FADV_WILLNEED);
posix_fadvise (fd, 0, 0, POSIX_FADV_DONTNEED);

Then again for posix_fadvise64.

Then run the resulting program under strace confirming that the last argument is correct.

Comment 6 john.haxby@oracle.com 2012-04-03 15:50:40 UTC
Created attachment 574903 [details]
Program to demonstrate the bug

Compile this as a 32 bit application on a 64 bit machine, then run "strace ./a.out".   You'll see an open(), two fadvise64() and two fadvise64_64() calls towards the end.   All of them should work.

Comment 10 errata-xmlrpc 2013-01-08 07:02:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0010.html


Note You need to log in before you can comment on or make changes to this bug.