Commit e354cbb2 authored by Li Huafei's avatar Li Huafei Committed by Jialin Zhang
Browse files

livepatch: Narrow the scope of the 'text_mutex' lock

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6NVPT



--------------------------------

Currently, arch_klp_code_modify_{prepare, post_process} is implemented
only in the x86 architecture. It is used to hold the 'text_mutex' lock
before entering the stop_machine and modifying the code, and to release
the lock after exiting the stop_machine. klp_mem_prepare() needs to hold
the 'text_mutex' lock only when saving old instruction code on x86 to
ensure that it holds valid instructions.

Place klp_mem_prepare() before arch_klp_code_modify_prepare() and lock the
save instruction action separately to narrow the 'text_mutex' lock.

Signed-off-by: default avatarLi Huafei <lihuafei1@huawei.com>
Reviewed-by: default avatarXu Kuohai <xukuohai@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
Reviewed-by: default avatarXu Kuohai <xukuohai@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 3b61044c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment