The purpose of this rust module is to test the integrity of the memory operations done by the rbpf rust module.
The obj files in eBPF are locates in src/ and most of them are modified directly in hex in order to avoid compiler optimizations. The only exceptions to this are: LD_ST_REG/ and stack_test/, which were correctly generated by the compiler.
If you get many errors of:
error: <unknown>:0:0: in function sample_func i64 (%struct.__sk_buff*): Looks like the BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
or
error: <unknown>:0:0: in function sample_func i64 (%struct.__sk_buff*): A call to built-in function '__stack_chk_fail' is not supported.
check that you have the latest version of llvm that supports allocation of arrays on stack. This tends to not work well on Mac OS, so try llvm on Linux.
Steps:
- Download and build the rbpf module in ../rbpf
- Run "cargo run" here in rbpf_test/, not in src/.