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 <vdavy...@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)
-- 
2.1.4

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to