Helper function bpf_override_return
Definition
Copyright (c) 2015 The Libbpf Authors. All rights reserved.
Used for error injection, this helper uses kprobes to override the return value of the probed function, and to set it to rc. The first argument is the context regs on which the kprobe works.
This helper works by setting the PC (program counter) to an override function which is run in place of the original probed function. This means the probed function is not run at all. The replacement function just returns with the required value.
This helper has security implications, and thus is subject to restrictions. It is only available if the kernel was compiled with the CONFIG_BPF_KPROBE_OVERRIDE configuration option, and in this case it only works on functions tagged with ALLOW_ERROR_INJECTION in the kernel code.
Returns
0
static long (* const bpf_override_return)(struct pt_regs *regs, __u64 rc) = (void *) 58;
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Program types
This helper call can be used in the following program types:
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome