Bug 67156 - pppd segfault due to not checking mmap() return value.
Summary: pppd segfault due to not checking mmap() return value.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: ppp
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-06-20 14:19 UTC by David Woodhouse
Modified: 2007-04-18 16:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-13 09:19:19 UTC
Embargoed:


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

Description David Woodhouse 2002-06-20 14:19:24 UTC
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 14:20:31 UTC
Created attachment 61804 [details]
Patch to make it actually check mmap() return value.

Comment 2 David Woodhouse 2002-06-20 14:24:05 UTC
Created attachment 61805 [details]
s/(void *)-1/MAP_FAILED/

Comment 3 Thomas Woerner 2004-08-13 09:19:19 UTC
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.