Re: [PATCH v2 2/2] slub: Add method to verify memory is not freed.
From: Ben Greear
Date: Thu Jul 07 2011 - 14:01:03 EST
On 07/01/2011 07:11 AM, Christoph Lameter wrote:
+#ifdef CONFIG_SLUB_DEBUG
+bool verify_mem_not_deleted(const void *x)
+{
+ struct page *page;
+ void *object = (void *)x;
+ unsigned long flags;
+ bool rv;
+
+ if (unlikely(ZERO_OR_NULL_PTR(x)))
+ return false;
+
+ local_irq_save(flags);
+
+ page = virt_to_head_page(x);
+ if (unlikely(!PageSlab(page))) {
+ /* maybe it was from stack? */
+ rv = true;
+ goto out_unlock;
+ }
The above check is problematic for slabs that have SLAB_DESTROY_BY_RCU
set. PageSlab(page) may be true to the next rcu interval.
I do not see the problem here. If PageSlab(page) is true, we fall
through and do the check for on-free-list, under the slab_lock().
We only return error if it is on the free list. Would these pages
waiting on the RCU interval show up as in the free list?
Thanks,
Ben
--
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc http://www.candelatech.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/