Commit 331e97e5 authored by Cheng Jian's avatar Cheng Jian Committed by Zheng Zengkai
Browse files

livepatch/ppc32: Fix func size less than limit



euler inclusion
category: feature
bugzilla: 51924
CVE: N/A

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

we need to modify the first 4 instructions of a livepatch function to
complete the long jump if offset out of short-range. So it's important
that this function must have more than 4 instructions, so we checked it
when the livepatch module insmod.

testcase : testEL_HOTPATCH_ADDFUNTOMULTIFILE_FUN-001
before this patch:
        insmod ./klp_patch.ko
        echo 1 > /sys/kernel/livepatch/klp_patch/enable
        echo 3 > /proc/sys/vm/drop_caches
        kernel crash, the call trace is like
        Call Trace:
                Unable to handler kernel paging request for instruction fetch
                Fualting instruction address: 0x00000000
                invalidate_mapping_pages+x0cc/0x180
                drop_pagecache_sb+0x84/0x94
                iterate_supers+0xf8/0xfc
                drop_caches_sysctl_handler+0x88/0x108
                proc_sys_call_handler+0xbc/0xfc
                __vfs_write+0x3c/0x154
                vfs_write+0xa0/0x114
                Sys_write+0x4c/0xc4
                ret_from_syscall+0x0/0x38

after this patch:
        insmod ./klp_patch.ko
                insmod: can't insert './klp_patch.ko': Operation not permitted

        dmesg -c
                livepatch: func drop_slab size(2) less than limit(4)

Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: default avatarLi Bin <huawei.libin@huawei.com>
Tested-by: default avatarCheng Jian <cj.chengjian@huawei.com>
Tested-by: default avatarWang Feng <wangfeng59@huawei.com>
Tested-by: default avatarLin DingYu <lindingyu@huawei.com>
Tested-by: default avatarYang ZuoTing <yangzuoting@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarzhangyi (F) <yi.zhang@huawei.com>

Signed-off-by: default avatarDong Kai <dongkai11@huawei.com>
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>

Signed-off-by: default avatarYe Weihua <yeweihua4@huawei.com>
Reviewed-by: default avatarKuohai Xu <xukuohai@huawei.com>
Reviewed-by: default avatarYang Jihong <yangjihong1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent c8d9cd59
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment