[Devel] [PATCH RHEL7 COMMIT] bc/mm: mmap_region: uncharge UB_LOCKEDPAGES if vma cannot be locked

Konstantin Khorenko khorenko at virtuozzo.com
Wed Dec 2 07:23:45 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rebase
------>
commit d4368be903f6018d4dfb7c273af49a3c31b8c08b
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Wed Dec 2 19:23:45 2015 +0400

    bc/mm: mmap_region: uncharge UB_LOCKEDPAGES if vma cannot be locked
    
    Fixes: b6d6ede8c4fc4 ("ve/bc/mm: port UB_PRIVVMPAGES, UB_SHMPAGES, and UB_LOCKEDPAGES accounting")
    
    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>
    Reviewed-by: Kirill Tkhai <ktkhai at odin.com>
---
 mm/mmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 7743313..befd381 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1654,8 +1654,10 @@ out:
 		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