Skip to contentSkip to conversation

Patch "mm: replace vma_lock_anon_vma with anon_vma_lock_read/write" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Feb 24, 2016

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

mm: replace vma_lock_anon_vma with anon_vma_lock_read/write

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mm-replace-vma_lock_anon_vma-with-anon_vma_lock_read-write.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 12352d3cae2cebe18805a91fab34b534d7444231 Mon Sep 17 00:00:00 2001

From: Konstantin Khlebnikov <[email protected]>
Date: Fri, 5 Feb 2016 15:36:50 -0800
Subject: mm: replace vma_lock_anon_vma with anon_vma_lock_read/write

From: Konstantin Khlebnikov <[email protected]>

commit 12352d3cae2cebe18805a91fab34b534d7444231 upstream.

Sequence vma_lock_anon_vma() - vma_unlock_anon_vma() isn't safe if anon_vma appeared between lock and unlock. We have to check anon_vma first or call anon_vma_prepare() to be sure that it's here. There are only few users of these legacy helpers. Let's get rid of them.

This patch fixes anon_vma lock imbalance in validate_mm(). Write lock isn't required here, read lock is enough.

And reorders expand_downwards/expand_upwards: security_mmap_addr() and wrapping-around check don't have to be under anon vma lock.

---
 include/linux/rmap.h |   14 ------------
 mm/mmap.c            |   55 +++++++++++++++++++++++----------------------------
 2 files changed, 25 insertions(+), 44 deletions(-)
include/linux/rmap.h +0 -14
@@ -108,20 +108,6 @@ static inline void put_anon_vma(struct a
 		__put_anon_vma(anon_vma);
 }
 
-static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
-{
-	struct anon_vma *anon_vma = vma->anon_vma;
-	if (anon_vma)
-		down_write(&anon_vma->root->rwsem);
-}
-
-static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
-{
-	struct anon_vma *anon_vma = vma->anon_vma;
-	if (anon_vma)
-		up_write(&anon_vma->root->rwsem);
-}
-
 static inline void anon_vma_lock_write(struct anon_vma *anon_vma)
 {
 	down_write(&anon_vma->root->rwsem);
mm/mmap.c +25 -30

122 lines not on this page · raw message

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/radix-tree-fix-oops-after-radix_tree_iter_retry.patch queue-4.4/mm-replace-vma_lock_anon_vma-with-anon_vma_lock_read-write.patch