[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200710194042.2510-1-urezki@gmail.com>
Date: Fri, 10 Jul 2020 21:40:42 +0200
From: "Uladzislau Rezki (Sony)" <urezki@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, LKML <linux-kernel@...r.kernel.org>,
Uladzislau Rezki <urezki@...il.com>,
Hillf Danton <hdanton@...a.com>,
Michal Hocko <mhocko@...e.com>,
Matthew Wilcox <willy@...radead.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@...ymobile.com>,
Steven Rostedt <rostedt@...dmis.org>
Subject: [PATCH 1/1] mm/vmalloc.c: Add an error message if two areas overlap
Before triggering a BUG() it would be useful to understand
how two areas overlap between each other. Print information
about start/end addresses of both VAs and their addresses.
For example if both are identical it could mean double free.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@...il.com>
---
mm/vmalloc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 5a2b55c8dd9a..1679b01febcd 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -549,8 +549,13 @@ find_va_links(struct vmap_area *va,
else if (va->va_end > tmp_va->va_start &&
va->va_start >= tmp_va->va_end)
link = &(*link)->rb_right;
- else
+ else {
+ pr_err("Overlaps: 0x%px(0x%lx-0x%lx), 0x%px(0x%lx-0x%lx)\n",
+ va, va->va_start, va->va_end, tmp_va,
+ tmp_va->va_start, tmp_va->va_end);
+
BUG();
+ }
} while (*link);
*parent = &tmp_va->rb_node;
@@ -1993,6 +1998,9 @@ static void vmap_init_free_space(void)
insert_vmap_area_augment(free, NULL,
&free_vmap_area_root,
&free_vmap_area_list);
+ insert_vmap_area_augment(free, NULL,
+ &free_vmap_area_root,
+ &free_vmap_area_list);
}
}
}
--
2.20.1
Powered by blists - more mailing lists