structpt_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; int xds; int xes; int xfs; int xgs; long orig_eax; long eip; int xcs; long eflags; long esp; int xss; };
long bpf_probe_read(void *dst, u32 size, const void *unsafe_ptr)
Description
For tracing programs, safely attempt to read size bytes from kernel space address unsafe_ptr and store the data in dst.
Generally, use bpf_probe_read_user() or bpf_probe_read_kernel() instead.
Return 0 on success, or a negative error in case of failure.
long bpf_probe_write_user(void *dst, const void *src, u32 len)
Description Attempt in a safe way to write len bytes from the buffer src to dst in memory. It only works for threads that are in user context, and dst must be a valid user space address.
This helper should not be used to implement any kind of security mechanism because of TOC-TOU attacks, but rather to debug, divert, and manipulate execution of emi-cooperative processes.
Keep in mind that this feature is meant for experiments, and it has a risk of crashing the system and running programs. Therefore, when an eBPF program using this helper is attached, a warning including PID and process name is printed to kernel logs.
Return 0 on success, or a negative error in case of failure.