Bug 146093 (IT_55591)

Summary: incorrect mmap flags with 32-bit binary on x86_64
Product: Red Hat Enterprise Linux 3 Reporter: Bastien Nocera <bnocera>
Component: straceAssignee: Roland McGrath <roland>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-130 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-19 21:10:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 132991, 146413, 154655    

Description Bastien Nocera 2005-01-25 11:20:44 UTC
Testcase:
#include <stdio.h>
int main(void)
{
        FILE *f;
        char a[100];
        char *b;
        f=fopen("abc","r");
        b=fgets(a,3,f);
        printf("b=%p\n",b);
}

On x86_64, with a 64-bit testcase (last mmap call):
<snip>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x2a9566e000
<snip>

On x86_64, with a 32-bit testcase (last mmap call):
<snip>
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, 0x3 /* MAP_??? */, 34,
0xffffffff) = 0x40017000
<snip>

0x3 would mean that the flags are MAP_SHARED|MAP_PRIVATE, and the file
descriptor is obviously wrong.

Comment 2 Roland McGrath 2005-02-02 03:19:05 UTC
I have fixed this upstream.  In fact, the bug was giving bad values
for the third and later arguments to all 32-bit syscalls on x86_64.
That bug was in the original x86_64 support for strace contributed
upstream by others.

Comment 9 Tim Powers 2005-05-19 21:10:05 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-131.html