Skip to contentSkip to conversation

mm/vmalloc.c: Add an error message if two areas overlap

PATCH New Uladzislau Rezki (Sony) 1 participant 1 message Jul 10, 2020

Subsystems (2)
lore
Share & tools
lore

Uladzislau Rezki (Sony)

author maintainer
#0 lore raw

PATCH v2 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.

---
 mm/vmalloc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
mm/vmalloc.c +6 -1
index 5a2b55c8dd9a..db2e1020dc51 100644
@@ -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;
Signature · 1 line
2.20.1