• O
    !178 bpf: add a bpf_override_reg helper · ea43b636
    openeuler-ci-bot 提交于
    Merge Pull Request from: @JqyangCode 
     
    [2022开源之夏] - 为ebpf添加新的辅助函数-bpf_override_reg ,功能是修改目标函数的寄存器,包括入参,返回值等
    --------------------------------------
    Error injection is a very important method for testing system stability. But for now,
    it is still lacking in this regard, but BPF can fill this gap perfectly with its kprobe
    function.
    
    We can use some validation methods to ensure that it only fires on calls we restrict.
    Although there are bpf_override_funciton that can complete some related operations
    before, this is a function that bypasses the initial detection and only modifies the
    return value to the specified value.This does not meet some of our practical scenarios:
    
    1. For example, other registers (such as input registers) need to be modified: when we
    receive a network packet, we will convert it into a structure and pass it to the corresponding
    function for processing.For the fault tolerance of network data, we need to modify the
    members of this structure, which it cannot do.
    
    2. The function cannot be mounted or what needs to be modified is not the function but the
    instruction: when the sensor reads the IO data, we need to simulate the IO data error.
    At this time, the reading of the IO data may not be a function, but a few simple instructions
    
    In summary, it is necessary to extend an interface that can modify any register, which can
    provide us with a simple way to achieve system error injection
    
    bugzilla: #I55FLX 
     
    Link:https://gitee.com/openeuler/kernel/pulls/178 
    Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
    Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
    ea43b636
bpf.h 201.9 KB