函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\livepatch\transition.c Create Date:2022-07-27 11:31:42
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:The transition to the target patch state is complete. Clean up the data* structures.

函数原型:static void klp_complete_transition(void)

返回类型:void

参数:

76  pr_debug("'%s': completing %s transition\n", Unique handle for this module , klp_target_state == KLP_PATCHED ? "patching" : "unpatching")
80  如果replaceklp_target_state恒等于KLP_PATCHED
81  This function unpatches objects from the replaced livepatches.* We could be pretty aggressive here. It is called in the situation where* these structures are no longer accessed from the ftrace handler.
82  This function removes the dynamically allocated 'nop' functions.* We could be pretty aggressive. NOPs do not change the existing* behavior except for adding unnecessary delay by the ftrace handler.* It is safe even when the transition was forced
85  如果klp_target_state恒等于KLP_UNPATCHED
90  klp_unpatch_objects(klp_transition_patch)
98  We allow to patch also functions where RCU is not watching,* e
101  klp_for_each_object(klp_transition_patch, obj)
102  klp_for_each_func(obj, func)
103  transition = false
106  如果klp_target_state恒等于KLP_PATCHEDWe allow to patch also functions where RCU is not watching,* e
109  read_lock( & tasklist_lock)
110  Careful: this is a double loop, 'break' won't work as expected. (g, task)
111  WARN_ON_ONCE(test_tsk_thread_flag(task, pending live patching update ))
112  patch_state等于ask patch states
114  read_unlock( & tasklist_lock)
116  遍历可用CPU(cpu)
117  task等于dle_task - return the idle task for a given CPU.*@cpu: the processor in question.* Return: The idle task for the CPU @cpu.
118  WARN_ON_ONCE(test_tsk_thread_flag(task, pending live patching update ))
119  patch_state等于ask patch states
122  klp_for_each_object(klp_transition_patch, obj)
123  如果非klp_is_object_loaded(obj)则继续下一循环
125  如果klp_target_state恒等于KLP_PATCHEDklp_post_patch_callback(obj)
127  否则如果klp_target_state恒等于KLP_UNPATCHEDklp_post_unpatch_callback(obj)
131  打印注释信息("'%s': %s complete\n", Unique handle for this module , klp_target_state == KLP_PATCHED ? "patching" : "unpatching")
134  klp_target_state等于ask patch states
135  klp_transition_patch = NULL
调用者
名称描述
klp_cancel_transitionThis is called in the error path, to cancel a transition before it has* started, i.e. klp_init_transition() has been called but* klp_start_transition() hasn't. If the transition *has* been started,* klp_reverse_transition() should be used instead.
klp_try_complete_transitionTry to switch all remaining tasks to the target patch state by walking the* stacks of sleeping tasks and looking for any to-be-patched or* to-be-unpatched functions. If such functions are found, the task can't be* switched yet.