bpf: add a bpf_override_regs helper
openeuler inclusion category: feature bugzilla: https://gitee.com/open_euler/dashboard?issue_id=I55FLX CVE: NA Reference: NA ------------------- 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 Signed-off-by: NJqyangCode <teanix@163.com>
Showing
想要评论请 注册 或 登录