Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Try 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.

Proto:void klp_try_complete_transition(void)

Type:void

Parameter:Nothing

393  bool complete = true
395  WARN_ON_ONCE(klp_target_state == ask patch states )
406  read_lock( & tasklist_lock)
407  Careful: this is a double loop, 'break' won't work as expected. (g, task)
408  If Not Try to safely switch a task to the target patch state. If it's currently* running, or it's sleeping on a to-be-patched or to-be-unpatched function, or* if the stack is unreliable, return false. Then complete = false
410  read_unlock( & tasklist_lock)
415  get_online_cpus()
416  for_each_possible_cpu(cpu)
417  task = dle_task - return the idle task for a given CPU.*@cpu: the processor in question.* Return: The idle task for the CPU @cpu.
418  If cpu_online(cpu) Then
421  Else if patch_state != klp_target_state Then
427  put_online_cpus()
429  If Not complete Then
430  If klp_signals_cnt && Not (klp_signals_cnt % SIGNALS_TIMEOUT) Then Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set.* Kthreads with TIF_PATCH_PENDING set are woken up.
432  klp_signals_cnt++
439  schedule_delayed_work - put work task in global workqueue after delay*@dwork: job to be done*@delay: number of jiffies to wait or 0 for immediate execution* After waiting for a given time this puts a job in the kernel-global* workqueue.
441  Return
445  patch = klp_transition_patch
446  The transition to the target patch state is complete. Clean up the data* structures.
453  If Not enabled Then klp_free_patch_async(patch)
455  Else if replace Then klp_free_replaced_patches_async(patch)
Caller
NameDescribe
__klp_enable_patch
klp_transition_work_fnThis work can be performed periodically to finish patching or unpatching any* "straggler" tasks which failed to transition in the first attempt.
__klp_disable_patchSysfs Interface* /sys/kernel/livepatch* /sys/kernel/livepatch/* /sys/kernel/livepatch//enabled* /sys/kernel/livepatch//transition* /sys/kernel/livepatch//force* /sys/kernel/livepatch//*