Bug 79311 - mmap MAP_SHARED doesn't work in one process
mmap MAP_SHARED doesn't work in one process
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
7.3
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-09 17:43 EST by Need Real Name
Modified: 2007-04-18 12:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-03-25 19:11:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test program (637 bytes, text/plain)
2002-12-09 17:46 EST, Need Real Name
no flags Details

  None (edit)
Description Need Real Name 2002-12-09 17:43:21 EST
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 17:46:41 EST
Created attachment 88086 [details]
test program
Comment 2 Arjan van de Ven 2002-12-10 03:29:58 EST
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-25 19:11:30 EST
Explanation posted seems good, resolving as notabug.
Comment 4 Need Real Name 2003-03-26 13:38:40 EST
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.