Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\livepatch\transition.c Create Date:2022-07-28 10:31:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:The transition to the target patch state is complete. Clean up the data* structures.

Proto:static void klp_complete_transition(void)

Type:void

Parameter:Nothing

76  pr_debug("'%s': completing %s transition\n", Unique handle for this module , klp_target_state == KLP_PATCHED ? "patching" : "unpatching")
80  If replace && klp_target_state == KLP_PATCHED Then
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  If klp_target_state == KLP_UNPATCHED Then
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  If klp_target_state == KLP_PATCHED Then We 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  for_each_possible_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  If Not klp_is_object_loaded(obj) Then Continue
125  If klp_target_state == KLP_PATCHED Then klp_post_patch_callback(obj)
127  Else if klp_target_state == KLP_UNPATCHED Then klp_post_unpatch_callback(obj)
131  pr_notice("'%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
Caller
NameDescribe
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.