Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__klp_enable_patch

Proto:static int __klp_enable_patch(struct klp_patch *patch)

Type:int

Parameter:

TypeParameterName
struct klp_patch *patch
927  If klp_transition_patch Then Return -EBUSY
930  If WARN_ON(enabled) Then Return -EINVAL
933  pr_notice("enabling patch '%s'\n", Unique handle for this module )
935  Initialize the global target patch state and all tasks to the initial patch* state, and initialize all function transition states to true in preparation* for patching or unpatching.
944  smp_wmb()
946  klp_for_each_object(patch, obj)
947  If Not klp_is_object_loaded(obj) Then Continue
950  ret = klp_pre_patch_callback(obj)
951  If ret Then
952  pr_warn("pre-patch callback failed for object '%s'\n", klp_is_module(obj) ? external : "vmlinux")
954  Go to err
957  ret = klp_patch_object(obj)
958  If ret Then
959  pr_warn("failed to patch object '%s'\n", klp_is_module(obj) ? external : "vmlinux")
961  Go to err
965  Start the transition to the specified target patch state so tasks can begin* switching to it.
966  enabled = true
967  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.
969  Return 0
970  err :
971  pr_warn("failed to enable patch '%s'\n", Unique handle for this module )
973  klp_cancel_transition()
974  Return ret
Caller
NameDescribe
klp_enable_patchklp_enable_patch() - enable the livepatch*@patch: patch to be enabled* Initializes the data structure associated with the patch, creates the sysfs* interface, performs the needed symbol lookups and code relocations,