Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 79311 - mmap MAP_SHARED doesn't work in one process
Summary: mmap MAP_SHARED doesn't work in one process
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 7.3
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-09 22:43 UTC by Need Real Name
Modified: 2007-04-18 16:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-03-26 00:11:30 UTC


Attachments (Terms of Use)
test program (deleted)
2002-12-09 22:46 UTC, Need Real Name
no flags Details

Description Need Real Name 2002-12-09 22:43:21 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003

Description of problem:
It appears that if mmap is called more than once on the same file in a single
process the flag MAP_SHARED is ignored, and a new memory is allocated for the
mapping.  Test code attached, save as t.c, compile with gcc -o t t.c, and run ./t.

test system is RedHat 7.3, kernel-smp-2.4.18-18.7.x, 
glibc-kernheaders-2.4-7.16, gcc-2.96-113, glibc-2.2.5-42.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.compile attached code
2.run attaced code
3.see pointer is different
	

Actual Results:  output of attached program is:
mp1 = 0x40014000
mp2 = 0x40016000


Expected Results:  mp1 = 0x40014000
mp2 = 0x40014000


Additional info:

Comment 1 Need Real Name 2002-12-09 22:46:41 UTC
Created attachment 88086 [details]
test program

Comment 2 Arjan van de Ven 2002-12-10 08:29:58 UTC
ehm
you ask for 2 mappings of the same file, you get 2 mappings; it will be the same
physical page however, just available at both addresses; MAP_SHARED doesn't mean
"return same virtual address" but "share phsyical memory between mmap users"

Comment 3 Brian Brock 2003-03-26 00:11:30 UTC
Explanation posted seems good, resolving as notabug.

Comment 4 Need Real Name 2003-03-26 18:38:40 UTC
Technically not a bug.  My problem, which was worked around with a wrapper, was
the process would run out of memory after mmaping a large file a second time. 
This seems undiserable to me,the process ran out of memory while not using any
more real memory.


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