lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210428153542.2814175-93-Liam.Howlett@Oracle.com>
Date:   Wed, 28 Apr 2021 15:36:31 +0000
From:   Liam Howlett <liam.howlett@...cle.com>
To:     "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
CC:     Song Liu <songliubraving@...com>,
        Davidlohr Bueso <dave@...olabs.net>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Matthew Wilcox <willy@...radead.org>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        David Rientjes <rientjes@...gle.com>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Rik van Riel <riel@...riel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Michel Lespinasse <walken.cr@...il.com>,
        Liam Howlett <liam.howlett@...cle.com>
Subject: [PATCH 92/94] mm: Return a bool from anon_vma_interval_tree_verify()

Added to allow printing which vma has the issue

Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
 include/linux/mm.h | 2 +-
 mm/interval_tree.c | 6 +++---
 mm/mmap.c          | 7 +++++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index e1f1ae32fa9d..6bf5369ad319 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2526,7 +2526,7 @@ anon_vma_interval_tree_iter_first(struct rb_root_cached *root,
 struct anon_vma_chain *anon_vma_interval_tree_iter_next(
 	struct anon_vma_chain *node, unsigned long start, unsigned long last);
 #ifdef CONFIG_DEBUG_VM_RB
-void anon_vma_interval_tree_verify(struct anon_vma_chain *node);
+bool anon_vma_interval_tree_verify(struct anon_vma_chain *node);
 #endif
 
 #define anon_vma_interval_tree_foreach(avc, root, start, last)		 \
diff --git a/mm/interval_tree.c b/mm/interval_tree.c
index 32e390c42c53..5958e27d4381 100644
--- a/mm/interval_tree.c
+++ b/mm/interval_tree.c
@@ -103,9 +103,9 @@ anon_vma_interval_tree_iter_next(struct anon_vma_chain *node,
 }
 
 #ifdef CONFIG_DEBUG_VM_RB
-void anon_vma_interval_tree_verify(struct anon_vma_chain *node)
+bool anon_vma_interval_tree_verify(struct anon_vma_chain *node)
 {
-	WARN_ON_ONCE(node->cached_vma_start != avc_start_pgoff(node));
-	WARN_ON_ONCE(node->cached_vma_last != avc_last_pgoff(node));
+	return WARN_ON_ONCE(node->cached_vma_start != avc_start_pgoff(node)) ||
+		WARN_ON_ONCE(node->cached_vma_last != avc_last_pgoff(node));
 }
 #endif
diff --git a/mm/mmap.c b/mm/mmap.c
index c2baf006bcde..ae1ffe726405 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -326,8 +326,10 @@ static void validate_mm(struct mm_struct *mm)
 		struct anon_vma_chain *avc;
 		if (anon_vma) {
 			anon_vma_lock_read(anon_vma);
-			list_for_each_entry(avc, &vma->anon_vma_chain, same_vma)
-				anon_vma_interval_tree_verify(avc);
+			list_for_each_entry(avc, &vma->anon_vma_chain, same_vma) {
+				if (anon_vma_interval_tree_verify(avc))
+					pr_warn("Interval tree issue in %px", vma);
+			}
 			anon_vma_unlock_read(anon_vma);
 		}
 #endif
@@ -339,6 +341,7 @@ static void validate_mm(struct mm_struct *mm)
 		pr_emerg("map_count %d mas_for_each %d\n", mm->map_count, i);
 		bug = 1;
 	}
+
 	VM_BUG_ON_MM(bug, mm);
 }
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ