lkml.org 
[lkml]   [2008]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: *sigh* /proc/*/pagemap
    > > >> 5) check with microscope allocation there -- page-aligned address and
    > > size
    > > >> == 0
    > > >> should allocate 0 bytes, and
    > > >
    > > > Where?
    > >
    > > kmalloc() in pagemap_read(). kmalloc(0) and integer wraparound look
    > > possible.

    Now that I unsuccessfully tried to reproduce multiplication wraparound (on 32-bit),
    integer wraparound in kmalloc() simply can't happen here.

    Relevant code from pagemap_read():

    uaddr = (unsigned long)buf & PAGE_MASK;
    uend = (unsigned long)(buf + count);
    pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE;
    pages = kmalloc(pagecount * sizeof(struct page *), GFP_KERNEL);


    pagecount is effectively "count / PAGE_SIZE", where "count" is size_t.
    kmalloc() takes size_t as first argument, so one has to overflow

    count / PAGE_SIZE * sizeof(pointer).

    For sure, page is bigger than pointer.

    Anyone still see holes?



    \
     
     \ /
      Last update: 2008-07-17 22:23    [W:0.024 / U:0.700 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site