[openib-general] [PATCH] huge pages support

Eli Cohen eli at mellanox.co.il
Wed Aug 23 04:31:31 PDT 2006


On Fri, 2006-08-18 at 15:23 +0200, Robert Rex wrote:
> Hello,
> 
> I've also worked on the same topic. Here is what I've done so far as I 
> successfully tested it on mthca and ehca. I'd appreciate for comments and 
> suggestions.
>  
> +	down_read(&current->mm->mmap_sem);
> +	if (is_vm_hugetlb_page(find_vma(current->mm, (unsigned long) addr))) {
> +		use_hugepages           = 1;
> +		region_page_mask        = HPAGE_MASK;
> +		region_page_size        = HPAGE_SIZE;

This might cause a kernel oops if the address passed by the user does
not belong to the process's address space. In that case find_vma() might
return NULL and is_vm_hugetlb() will crash.
And even if find_vma() returns none NULL value, that still does not
guarantee that the vma returned is the one that contains that address.
You need to check that the address is greater then or equal to
vma->vm_start.





More information about the general mailing list