Bug 67156 - pppd segfault due to not checking mmap() return value.
pppd segfault due to not checking mmap() return value.
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: ppp (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Thomas Woerner
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-06-20 10:19 EDT by David Woodhouse
Modified: 2007-04-18 12:43 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-13 05:19:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to make it actually check mmap() return value. (1004 bytes, patch)
2002-06-20 10:20 EDT, David Woodhouse
no flags Details | Diff
s/(void *)-1/MAP_FAILED/ (1004 bytes, patch)
2002-06-20 10:24 EDT, David Woodhouse
no flags Details | Diff

  None (edit)
Description David Woodhouse 2002-06-20 10:19:24 EDT
pppd/tdb.c does this:

        tdb->map_ptr = (void *)mmap(NULL, tdb->map_size, 
                                    tdb->read_only?PROT_READ:PROT_READ|PROT_WRITE,
                                    MAP_SHARED | MAP_FILE, tdb->fd, 0);

If the mmap() fails (some filesystems don't do shared writable mappings) then
mmap will return -1.

Then it does this:

        if (tdb->map_ptr) {
                memcpy(offset + (char *)tdb->map_ptr, buf, len);
        } else {
            /* .... lseek/write ... */
        }

Then it dies.
Comment 1 David Woodhouse 2002-06-20 10:20:31 EDT
Created attachment 61804 [details]
Patch to make it actually check mmap() return value.
Comment 2 David Woodhouse 2002-06-20 10:24:05 EDT
Created attachment 61805 [details]
s/(void *)-1/MAP_FAILED/
Comment 3 Thomas Woerner 2004-08-13 05:19:19 EDT
Please verify this with a newer version of Red Hat Enterprise Linux or Fedora
Core and reopen it against the new version if it still occurs.

Closing as "not a bug" for now.

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