Re: [PATCH backport to 3.4] hugetlbfs: fix mmap failure in unaligned size request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013/5/10 15:29, Li Zefan wrote:

> On 2013/5/10 14:08, Jianguo Wu wrote:
>> Hi Greg,
>> I rebase "[PATCH] hugetlbfs: fix mmap failure in unaligned size request" on 3.4,
>> could you please apply to 3.4-stable.
>>
> 
> Then you should also backport this commit to 3.4:
> 
> 091d0d55b286c9340201b4ed4470be87fc568228
> ("shm: fix null pointer deref when userspace specifies invalid hugepage size")

Hi Zefan,

3.4 only support default hugepage size for MAP_HUGETLB/SHM_HUGETLB, userspace
can not specifies hugepage size.

I modified the patch, it only deref from &default_hstate, So can't hit NULL pointer.

Thanks.

> 
>> Chagelog:
>>  - remove hstate_sizelog(), as 3.4 only support default hugepagesize for
>>    MAP_HUGETLB/SHM_HUGETLB.
>>
>>
>> From: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
>>
>> commit af73e4d9506d3b797509f3c030e7dcd554f7d9c4 upstream.
>>
>> The current kernel returns -EINVAL unless a given mmap length is
>> "almost" hugepage aligned.  This is because in sys_mmap_pgoff() the
>> given length is passed to vm_mmap_pgoff() as it is without being aligned
>> with hugepage boundary.
>>
>> This is a regression introduced in commit 40716e29243d ("hugetlbfs: fix
>> alignment of huge page requests"), where alignment code is pushed into
>> hugetlb_file_setup() and the variable len in caller side is not changed.
>>
>> To fix this, this patch partially reverts that commit, and adds
>> alignment code in caller side.  And it also introduces hstate_sizelog()
>> in order to get proper hstate to specified hugepage size.
>>
>> Addresses https://bugzilla.kernel.org/show_bug.cgi?id=56881
>>
> 
> 
> .
> 



--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]