lkml.org 
[lkml]   [2012]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRE: [PATCH] mm: mmap() sometimes succeeds even if the region to map is invalid.
    > The detail of these problems is as follows:

    > 1. mmap() succeeds even if "offset" argument is a negative value, although
    > it should return EINVAL in such case.

    > In such case, it is actually regarded as big positive value
    > because the type of "off" is "unsigned long" in the kernel.
    > For example, off=-4096 (-0x1000) is regarded as
    > off = 0xfffffffffffff000 (x86_64) and as off = 0xfffff000 (x86).
    > It results in mapping too big offset region.

    It is not true always.

    Considering your example, say if page size is 4k, then PAGE_MASK = 0xFFF
    hence (off & ~PAGE_MASK) will be true and " -EINVAL" will be returned.


    \
     
     \ /
      Last update: 2012-02-17 10:07    [W:0.022 / U:30.076 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site