Bug 162467

Summary: strace for x86-64 doesn't decode old_mmap for 32-bit properly
Product: Red Hat Enterprise Linux 3 Reporter: Roland McGrath <roland>
Component: straceAssignee: Roland McGrath <roland>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: mwesley, tao
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-635 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-28 19:18:58 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:    
Bug Blocks: 156320, 160049, 164215    

Description Roland McGrath 2005-07-05 09:44:40 UTC
There are actually two bugs here, one kernel and one strace.
The original test case uses mmap2, but the complaints are about old_mmap.
The mmap2 values are wrong due to the kernel bug #160049.
The old_mmap values are wrong due to an strace bug, which this entry will now track.

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

$ uname -a
Linux bnocera 2.6.9-1.906_EL #1 Sun Dec 12 22:51:52 EST 2004 i686 i686 i386
GNU/Linux
$ file test
test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux
2.2.5, dynamically linked (uses shared libs), not stripped
$ strace -v ./a.out 2>&1 | grep old
old_mmap(NULL, 76063, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fed000
old_mmap(0x469000, 1215644, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0x469000
old_mmap(0x58c000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x123000) = 0x58c000
old_mmap(0x590000, 7324, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x590000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7fec000

On the 64 bit machine:
rpm -q strace
strace-4.5.9-2.EL3
[root@host-59 tmp]# uname -a
Linux host-59.support.localnet 2.4.21-27.0.2.ELsmp #1 SMP Wed Jan 12 23:25:44
EST 2005 x86_64 x86_64 x86_64 GNU/Linux
[root@host-59 tmp]# file test
test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux
2.2.5, dynamically linked (uses shared libs), not stripped
[root@host-59 tmp]# strace -v ./test 2>&1 | grep old
old_mmap(0xedf500000000, 8589934593, PROT_READ|PROT_WRITE, 0xf /* MAP_???
*/|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE|MAP_POPULATE|MAP_NONBLOCK|MAP_GROWSDOWN|MAP_DENYWRITE|MAP_EXECUTABLE|MAP_LOCKED|0xfffe06c0,
14849, 0x3b55b00000000) = 0x40016000
old_mmap(0x1375cc00000000, 8589934597, PROT_READ|PROT_WRITE, MAP_FILE, 0, 0) =
0x40025000
old_mmap(0x300040157000, 77309411331, PROT_READ|PROT_WRITE, MAP_FILE, 0, 0) =
0x40157000
old_mmap(0x25cc4015a000, 214748364803,
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN|PROT_GROWSUP|0xfcfffff8, MAP_FILE,
0, 0) = 0x4015a000
old_mmap(0x100000000000, 146028888067,
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN|PROT_GROWSUP|0xfcfffff8, 0x8 /*
MAP_???
*/|MAP_FIXED|MAP_NORESERVE|MAP_NONBLOCK|MAP_GROWSDOWN|MAP_EXECUTABLE|0x40000400,
1073744439, 0x840010307) = 0x4015d000
old_mmap()                              = -1 EFAULT (Bad address)

test is built from the test.c below:
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/mman.h>

int main (int argc, char **argv)
{
        syscall (SYS_mmap2, NULL, 88983, PROT_READ, MAP_PRIVATE, 3, 0);
        return 0;
}

Comment 1 Roland McGrath 2005-07-05 09:51:35 UTC
I've fixed the old_mmap values for x86-64 tracing 32-bit inferiors.
The fix is now in upstream, and will go into the RHEL3 erratum next update.

Comment 6 Red Hat Bugzilla 2005-09-28 19:18:59 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 the 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-2005-635.html