Bug 145746 - mmap() system call can return Nil
mmap() system call can return Nil
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
i686 Linux
medium Severity low
: ---
: ---
Assigned To: Rik van Riel
Ben Levenson
: 158879 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2005-01-20 19:56 EST by Geronimo A. Ordanza II
Modified: 2007-11-30 17:07 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-05-18 09:29:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Sample program to illustrate the problem (573 bytes, text/plain)
2005-01-20 20:01 EST, Geronimo A. Ordanza II
no flags Details

  None (edit)
Description Geronimo A. Ordanza II 2005-01-20 19:56:17 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0

Description of problem:
Problem:  mmap() system call can return Nil 
 The manual page states that a Nil return is not possible: 
------------ Cut Here -------- Cut Here 

 MMAP(2)                    Linux Programmer's Manual                
        mmap, munmap - map or unmap files or devices into memory 
        #include <sys/mman.h> 
        void  *  mmap(void *start, size_t length, int prot , int
flags, int fd, 
        off_t offset); 
        int munmap(void *start, size_t length); 
        The mmap function asks to map length bytes starting  at 
offset  offset 
        from  the  file  (or  other object) specified by the file
descriptor fd 
        into memory, preferably at address start.  This  latter 
address  is  a 
        hint  only,  and is usually specified as 0.  The actual place
where the 
        object is mapped is returned by mmap, and is never 0. 
------------ Cut Here -------- Cut Here 
 Note the last line:  "... returned by mmap, and is never 0." 
 Allowing mmap() to return Nil causes all sorts of problems. 
 Not the least of which de-referencing Nil no longer causes a SEGV. 
 Not a happy state of affairs. 

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

How reproducible:

Steps to Reproduce:
1. Sample program is attached to reproduce the problem

Expected Results:  mmap should not return 0 because it never
places a memory mapping at address 0.
mmap returns -1 (the value of the MAP_FAILED
macro) on failure.

Additional info:
Comment 1 Geronimo A. Ordanza II 2005-01-20 20:01:15 EST
Created attachment 110038 [details]
Sample program to illustrate the problem
Comment 2 Geronimo A. Ordanza II 2005-01-20 20:04:47 EST
Linking this bugzilla ID to Issue Tracker (ie. 63665)

Comment 3 Ernie Petrides 2005-02-07 15:30:25 EST
This has been deemed a kernel bug in the mmap() system call handling.

A fix for this problem was committed to the RHEL3 U5 patch pool last
week on 3-Feb-2005 (in kernel version 2.4.21-27.11.EL).
Comment 4 Tim Powers 2005-05-18 09:29:09 EDT
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.

Comment 5 Ernie Petrides 2005-05-26 17:28:32 EDT
*** Bug 158879 has been marked as a duplicate of this bug. ***

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