[Devel] [PATCH rh7] mm: mmap_region: uncharge UB_LOCKEDPAGES if vma cannot be locked

Konstantin Khorenko khorenko at virtuozzo.com
Thu Nov 26 08:07:57 PST 2015


Kirill, please review.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 11/26/2015 06:08 PM, Vladimir Davydov wrote:
> mmap_region workflow regarding locked pages was changed during rebase
> from RH6 to RH7. The patch porting locked pages accounting did not allow
> for that.
>
> Presumably, this should fix UB_LOCKEDPAGES leak on CT stop:
>
>    Ub 101 helds 8 in lockedpages on put
>    UB: leaked beancounter 101 (ffff880404e95000)
>    Tainting kernel with flag 0xa
>
> https://jira.sw.ru/browse/PSBM-39435
>
> Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
> ---
>   mm/mmap.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 8796ed643a6f..b981d80ab100 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1654,8 +1654,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
>   		if (!((vm_flags & VM_SPECIAL) || is_vm_hugetlb_page(vma) ||
>   					vma == get_gate_vma(current->mm)))
>   			mm->locked_vm += (len >> PAGE_SHIFT);
> -		else
> +		else {
>   			vma->vm_flags &= ~VM_LOCKED;
> +			ub_locked_uncharge(mm, len);
> +		}
>   	}
>
>   	if (file)
>


More information about the Devel mailing list