Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

Proto:static bool klp_try_switch_task(struct task_struct *task)

Type:bool

Parameter:

TypeParameterName
struct task_struct *task
287  bool success = false
289  err_buf[0] = '\0'
292  If patch_state == klp_target_state Then Return true
299  If Not klp_have_reliable_stack() Then Return false
307  rq = ask_rq_lock - lock p->pi_lock and lock the rq @p resides on.
309  If task_running(rq, task) && task != current process Then
310  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
313  Go to done
316  ret = Determine whether it's safe to transition the task to the target patch state* by looking for any to-be-patched or to-be-unpatched functions on its stack.
317  If ret Then Go to done
320  success = true
322  clear_tsk_thread_flag(task, pending live patching update )
323  patch_state = klp_target_state
325  done :
326  task_rq_unlock(rq, task, & flags)
333  If err_buf[0] != '\0' Then pr_debug("%s", err_buf)
336  Return success
Caller
NameDescribe
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.