函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称: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.

函数原型:static bool klp_try_switch_task(struct task_struct *task)

返回类型:bool

参数:

类型参数名称
struct task_struct *task
287  bool success = false
289  err_buf[0]等于'\0'
292  如果patch_state恒等于klp_target_state则返回:true
299  如果非klp_have_reliable_stack()则返回:false
307  rq等于ask_rq_lock - lock p->pi_lock and lock the rq @p resides on.
309  如果task_running(rq, task)且task不等于当前进程
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  转到: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  如果ret则转到:done
320  success = true
322  清除线程指定标志
323  patch_state等于klp_target_state
325  done :
326  task_rq_unlock(rq, task, & flags)
333  如果err_buf[0]不等于'\0'则pr_debug("%s", err_buf)
336  返回:success
调用者
名称描述
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.