Lines Matching full:object

136 void __kasan_unpoison_object_data(struct kmem_cache *cache, void *object)  in __kasan_unpoison_object_data()  argument
138 kasan_unpoison(object, cache->object_size, false); in __kasan_unpoison_object_data()
141 void __kasan_poison_object_data(struct kmem_cache *cache, void *object) in __kasan_poison_object_data() argument
143 kasan_poison(object, round_up(cache->object_size, KASAN_GRANULE_SIZE), in __kasan_poison_object_data()
148 * This function assigns a tag to an object considering the following:
150 * object somewhere (e.g. in the object itself). We preassign a tag for
151 * each object in caches with constructors during slab creation and reuse
152 * the same tag each time a particular object is allocated.
162 const void *object, bool init) in assign_tag() argument
169 * set, assign a tag when the object is being allocated (init == false). in assign_tag()
176 /* For SLAB assign tags based on the object index in the freelist. */ in assign_tag()
177 return (u8)obj_to_index(cache, virt_to_slab(object), (void *)object); in assign_tag()
183 return init ? kasan_random_tag() : get_tag(object); in assign_tag()
188 const void *object) in __kasan_init_slab_obj() argument
190 /* Initialize per-object metadata if it is present. */ in __kasan_init_slab_obj()
192 kasan_init_object_meta(cache, object); in __kasan_init_slab_obj()
195 object = set_tag(object, assign_tag(cache, object, true)); in __kasan_init_slab_obj()
197 return (void *)object; in __kasan_init_slab_obj()
200 static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object, in ____kasan_slab_free() argument
208 tagged_object = object; in ____kasan_slab_free()
209 object = kasan_reset_tag(object); in ____kasan_slab_free()
211 if (is_kfence_address(object)) in ____kasan_slab_free()
214 if (unlikely(nearest_obj(cache, virt_to_slab(object), object) != in ____kasan_slab_free()
215 object)) { in ____kasan_slab_free()
229 kasan_poison(object, round_up(cache->object_size, KASAN_GRANULE_SIZE), in ____kasan_slab_free()
238 return kasan_quarantine_put(cache, object); in ____kasan_slab_free()
241 bool __kasan_slab_free(struct kmem_cache *cache, void *object, in __kasan_slab_free() argument
244 return ____kasan_slab_free(cache, object, ip, true, init); in __kasan_slab_free()
260 * The object will be poisoned by kasan_poison_pages() or in ____kasan_kfree_large()
296 void *object, gfp_t flags, bool init) in __kasan_slab_alloc() argument
304 if (unlikely(object == NULL)) in __kasan_slab_alloc()
307 if (is_kfence_address(object)) in __kasan_slab_alloc()
308 return (void *)object; in __kasan_slab_alloc()
314 tag = assign_tag(cache, object, false); in __kasan_slab_alloc()
315 tagged_object = set_tag(object, tag); in __kasan_slab_alloc()
318 * Unpoison the whole object. in __kasan_slab_alloc()
331 const void *object, size_t size, gfp_t flags) in ____kasan_kmalloc() argument
339 if (unlikely(object == NULL)) in ____kasan_kmalloc()
342 if (is_kfence_address(kasan_reset_tag(object))) in ____kasan_kmalloc()
343 return (void *)object; in ____kasan_kmalloc()
346 * The object has already been unpoisoned by kasan_slab_alloc() for in ____kasan_kmalloc()
352 * Partially poison the last object granule to cover the unaligned in ____kasan_kmalloc()
356 kasan_poison_last_granule((void *)object, size); in ____kasan_kmalloc()
359 redzone_start = round_up((unsigned long)(object + size), in ____kasan_kmalloc()
361 redzone_end = round_up((unsigned long)(object + cache->object_size), in ____kasan_kmalloc()
371 kasan_save_alloc_info(cache, (void *)object, flags); in ____kasan_kmalloc()
374 return (void *)object; in ____kasan_kmalloc()
377 void * __must_check __kasan_kmalloc(struct kmem_cache *cache, const void *object, in __kasan_kmalloc() argument
380 return ____kasan_kmalloc(cache, object, size, flags); in __kasan_kmalloc()
397 * The object has already been unpoisoned by kasan_unpoison_pages() for in __kasan_kmalloc_large()
403 * Partially poison the last object granule to cover the unaligned in __kasan_kmalloc_large()
419 void * __must_check __kasan_krealloc(const void *object, size_t size, gfp_t flags) in __kasan_krealloc() argument
423 if (unlikely(object == ZERO_SIZE_PTR)) in __kasan_krealloc()
424 return (void *)object; in __kasan_krealloc()
427 * Unpoison the object's data. in __kasan_krealloc()
431 kasan_unpoison(object, size, false); in __kasan_krealloc()
433 slab = virt_to_slab(object); in __kasan_krealloc()
437 return __kasan_kmalloc_large(object, size, flags); in __kasan_krealloc()
439 return ____kasan_kmalloc(slab->slab_cache, object, size, flags); in __kasan_krealloc()