Bug 67156

Summary: pppd segfault due to not checking mmap() return value.
Product: [Retired] Red Hat Linux Reporter: David Woodhouse <dwmw2>
Component: pppAssignee: Thomas Woerner <twoerner>
Status: CLOSED NOTABUG QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-13 09:19:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to make it actually check mmap() return value.
none
s/(void *)-1/MAP_FAILED/ none

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.