Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\kmemleak.c Create Date:2022-07-28 16:22:03
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

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

Proto:static void scan_block(void *_start, void *_end, struct kmemleak_object *scanned)

Type:void

Parameter:

TypeParameterName
void *_start
void *_end
struct kmemleak_object *scanned
1231  start = PTR_ALIGN(_start, BYTES_PER_POINTER)
1232  end = _end - BYTES_PER_POINTER - 1
1236  read_lock_irqsave( & w_lock protecting the access to object_list and object_tree_root , flags)
1237  When ptr < end cycle
1242  If Memory scanning is a long process and it needs to be interruptable. This* function checks whether such interrupt condition occurred. Then Break
1245  kasan_disable_current()
1246  pointer = ptr
1247  kasan_enable_current()
1249  untagged_ptr = kasan_reset_tag((void * )pointer)
1250  If untagged_ptr < minimum and maximum address that may be valid pointers || untagged_ptr >= max_addr Then Continue
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  If Not object Then Continue
1262  If object == scanned Then Continue
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  If color_gray(object) Then
1276  Else
1277  excess_ref = 0
1280  spin_unlock( & lock)
1282  If excess_ref Then
1284  If Not object Then Continue
1286  If object == scanned Then Continue
1291  spin_unlock( & lock)
1294  read_unlock_irqrestore( & w_lock protecting the access to object_list and object_tree_root , flags)
Caller
NameDescribe
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.