The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] mm/damon/vaddr: check address space stability before VMA traversal
@ 2026-06-30 15:25 Igor Putko
  2026-07-01  1:08 ` SJ Park
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Putko @ 2026-06-30 15:25 UTC (permalink / raw)
  To: sj; +Cc: akpm, damon, linux-mm, linux-kernel, Igor Putko

In __damon_va_three_regions(), the VMA tree is traversed without
checking if the address space is stable. If the OOM reaper runs
concurrently, it may mark the mm as MMF_UNSTABLE and leave empty
markers in the maple tree.
Add a check_stable_address_space(mm) call before iterating over
the VMAs to avoid potential NULL pointer dereferences.

Signed-off-by: Igor Putko <igorpetindev@gmail.com>
---
 mm/damon/vaddr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 345b89b5d..e756ac147 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -11,6 +11,7 @@
 #include <linux/hugetlb.h>
 #include <linux/mman.h>
 #include <linux/mmu_notifier.h>
+#include <linux/oom.h>
 #include <linux/page_idle.h>
 #include <linux/pagewalk.h>
 #include <linux/sched/mm.h>
@@ -84,6 +85,9 @@ static int __damon_va_three_regions(struct mm_struct *mm,
 	 * If this is too slow, it can be optimised to examine the maple
 	 * tree gaps.
 	 */
+	if (!check_stable_address_space(mm))
+		return -EINVAL;
+
 	for_each_vma(vmi, vma) {
 		unsigned long gap;
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/damon/vaddr: check address space stability before VMA traversal
  2026-06-30 15:25 [PATCH] mm/damon/vaddr: check address space stability before VMA traversal Igor Putko
@ 2026-07-01  1:08 ` SJ Park
  0 siblings, 0 replies; 2+ messages in thread
From: SJ Park @ 2026-07-01  1:08 UTC (permalink / raw)
  To: Igor Putko; +Cc: SJ Park, akpm, damon, linux-mm, linux-kernel

On Tue, 30 Jun 2026 18:25:58 +0300 Igor Putko <igorpetindev@gmail.com> wrote:

> In __damon_va_three_regions(), the VMA tree is traversed without
> checking if the address space is stable. If the OOM reaper runs
> concurrently, it may mark the mm as MMF_UNSTABLE and leave empty
> markers in the maple tree.

I initially thought this is correct, but...  Hasn't the series starting from
commit bed76bec3111 ("mm: relocate the page table ceiling and floor
definitions") fixed the issue?


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-01  1:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 15:25 [PATCH] mm/damon/vaddr: check address space stability before VMA traversal Igor Putko
2026-07-01  1:08 ` SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox