Ticket #6312: slab-ReturnObjectToSlab-protect-from-wrong-freed-object-v2.patch
File slab-ReturnObjectToSlab-protect-from-wrong-freed-object-v2.patch, 845 bytes (added by , 14 years ago) |
---|
-
src/system/kernel/slab/ObjectCache.cpp
203 203 204 204 ParanoiaChecker _(source); 205 205 206 #if KDEBUG >= 1 207 uint8* objectsStart = (uint8*)source->pages + source->offset; 208 if (object < objectsStart 209 || object >= objectsStart + source->size * object_size) { 210 panic("object_cache: free'd object does not belong to this slab"); 211 return; 212 } 213 214 if (((uint8*)object - objectsStart) % object_size != 0) { 215 panic("object_cache: returning a wrong pointer to a slab object"); 216 return; 217 } 218 #endif // KDEBUG 219 206 220 object_link* link = object_to_link(object, object_size); 207 221 208 222 TRACE_CACHE(this, "returning %p (%p) to %p, %lu used (%lu empty slabs).",