函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\kmemleak.c Create Date:2022-07-27 17:56:50
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Scan a memory block (exclusive range) for valid pointers and add those* found to the gray list.

函数原型:static void scan_block(void *_start, void *_end, struct kmemleak_object *scanned)

返回类型:void

参数:

类型参数名称
void *_start
void *_end
struct kmemleak_object *scanned
1231  start等于PTR_ALIGN(_start, BYTES_PER_POINTER)
1232  end等于_endBYTES_PER_POINTER减1
1236  read_lock_irqsave( & w_lock protecting the access to object_list and object_tree_root , flags)
1237 ptr小于end循环
1242  如果Memory scanning is a long process and it needs to be interruptable. This* function checks whether such interrupt condition occurred.退出
1245  kasan_disable_current()
1246  pointer等于ptr
1247  kasan_enable_current()
1249  untagged_ptr等于kasan_reset_tag((void * )pointer)
1250  如果untagged_ptr小于minimum and maximum address that may be valid pointers untagged_ptr大于等于max_addr则继续下一循环
1259  object等于Look-up a memory block metadata (kmemleak_object) in the object search* tree based on a pointer value. If alias is 0, only values pointing to the* beginning of the memory block are allowed. The kmemleak_lock must be held* when calling this function.
1260  如果非object则继续下一循环
1262  如果object恒等于scanned则继续下一循环
1271  spin_lock_nested( & lock, For trivial one-depth nesting of a lock-class, the following* global define can be used. (Subsystems with multiple levels* of nesting should define their own lock-nesting subclasses.))
1273  如果color_gray(object)则
1276  否则
1277  excess_ref等于0
1280  自旋锁解锁
1282  如果excess_ref
1284  如果非object则继续下一循环
1286  如果object恒等于scanned则继续下一循环
1294  read_unlock_irqrestore( & w_lock protecting the access to object_list and object_tree_root , flags)
调用者
名称描述
scan_objectScan a memory block corresponding to a kmemleak_object. A condition is* that object->use_count >= 1.
kmemleak_scanScan data sections and all the referenced memory blocks allocated via the* kernel's standard allocators. This function must be called with the* scan_mutex held.