arena: warn instead of panic for free-checks
These checks are signs of bugs, but we can proceed by just returning.
For the size-mismatch, we could try and free the correct size, but since
there is some bug, we should be safe and just not free anything.
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/arena.c b/kern/src/arena.c
index b51bd4e..ca624aa 100644
--- a/kern/src/arena.c
+++ b/kern/src/arena.c
@@ -1135,12 +1135,16 @@
spin_lock_irqsave(&arena->lock);
bt = __untrack_alloc_seg(arena, (uintptr_t)addr);
- if (!bt)
- panic("Free of unallocated addr %p from arena %s", addr,
- arena->name);
- if (bt->size != size)
- panic("Free of %p with wrong size %p (%p) from arena %s", addr,
+ if (!bt) {
+ warn("Free of unallocated addr %p size %p from arena %s", addr,
+ arena->name, size);
+ return;
+ }
+ if (bt->size != size) {
+ warn("Free of %p with wrong size %p (%p) from arena %s", addr,
size, bt->size, arena->name);
+ return;
+ }
arena->amt_alloc_segs -= size;
__track_free_seg(arena, bt);
__coalesce_free_seg(arena, bt, &to_free_addr, &to_free_sz);