Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:klp_patch_func

Proto:static int klp_patch_func(struct klp_func *func)

Type:int

Parameter:

TypeParameterName
struct klp_func *func
174  If WARN_ON(!rnal ) Then Return -EINVAL
177  If WARN_ON(patched) Then Return -EINVAL
180  ops = klp_find_ops(rnal )
181  If Not ops Then
184  ftrace_loc = Convert a function address into the appropriate ftrace location.* Usually this is just the address of the function, but on some architectures* it's more complicated so allow them to provide a custom behaviour.
186  If Not ftrace_loc Then
187  pr_err("failed to find location for function '%s'\n", xternal )
189  Return -EINVAL
192  ops = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
193  If Not ops Then Return -ENOMEM
196  func = klp_ftrace_handler
197  flags = FTRACE_OPS_FL_SAVE_REGS | FTRACE_OPS_FL_DYNAMIC | FTRACE_OPS_FL_IPMODIFY | FTRACE_OPS_FL_PERMANENT
202  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
204  Initialization list head
205  list_add_rcu - add a new entry to rcu-protected list*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head
207  ret = ftrace_set_filter_ip( & fops, ftrace_loc, 0, 0)
208  If ret Then
209  pr_err("failed to set ftrace filter for function '%s' (%d)\n", xternal , ret)
211  Go to err
214  ret = gister_ftrace_function - register a function for profiling*@ops - ops structure that holds the function for profiling
215  If ret Then
216  pr_err("failed to register ftrace handler for function '%s' (%d)\n", xternal , ret)
219  Go to err
223  Else
224  list_add_rcu - add a new entry to rcu-protected list*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head
227  patched = true
229  Return 0
231  err :
232  list_del_rcu - deletes entry from list without re-initialization*@entry: the element to delete from the list
233  deletes entry from list
234  kfree(ops)
235  Return ret
Caller
NameDescribe
klp_patch_object